Creating partitions in linux

I followed below procedure for creating various partitions in linux

[root@ovmapp1 ~]# fdisk /dev/sdc

Command (m for help): d
Selected partition 1

Command (m for help): p  ===> print partition table

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

 Device Boot      Start         End      Blocks   Id  System

Command (m for help): n  ===> New partition
Command action
 e   extended
 p   primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-652, default 652):
Using default value 652

Command (m for help): p

Disk /dev/sdc: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

 Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         652     5237158+  83  Linux

Command (m for help):
Command (m for help): w  ===> write to partition tabel, If write is not given partion table will not be modified
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@ovmapp1 ~]#

[root@ovmapp1 ~]# mkfs -t ext3 /dev/sdc1  ===> Creating ext3 format file system
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
655360 inodes, 1309289 blocks
65464 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912, 819200, 884736

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@ovmapp1 ~]# e2label /dev/sdc1 /arch   ===> e2label command will assign label to the partition,
[root@ovmapp1 ~]#
Before mounting the new partition, below is the output of df -h
[root@ovmapp1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.0G  6.5G  2.1G  77% /
none                  295M     0  295M   0% /dev/shm
/dev/sda2             9.7G  6.2G  3.0G  68% /oracle
/dev/sdb1             9.9G   55M  9.3G   1% /oradata
[root@ovmapp1 ~]#
[root@ovmapp1 ~]# mkdir /arch
[root@ovmapp1 ~]#
[root@ovmapp1 ~]# mount -t ext3 /dev/sdc1 /arch  ===> Mounting ext3 file system to a directory
[root@ovmapp1 ~]#
[root@ovmapp1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             9.0G  6.5G  2.1G  77% /
none                  295M     0  295M   0% /dev/shm
/dev/sda2             9.7G  6.2G  3.0G  68% /oracle
/dev/sdb1             9.9G   55M  9.3G   1% /oradata
/dev/sdc1             5.0G   43M  4.7G   1% /arch
[root@ovmapp1 ~]#
Add the entries to /etc/fstab file to automount the new partition after evry reboot
[root@ovmapp1 ~]# cat /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/oracle           /oracle                 ext3    defaults        1 2
LABEL=/oradata          /oradata                ext3    defaults        0 0
LABEL=/arch             /arch                   ext3    defaults        0 0
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
LABEL=SWAP-sda3         swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
Advertisement

About leenus2b

Lohman Castings, Pioneers in Cast Iron, Steel, Nickel-Chromium and many other types of Castings manufacturers. An ISO:9001-2000 Certified Company
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s