Creating a new partitions
File System Tools
How to create new partition using fdisk
Step1: [root@localhost bash]# fdisk -l
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000030ad
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 523 4096575 83 Linux
/dev/sda3 524 905 3068415 83 Linux
/dev/sda4 906 1305 3213000 5 Extended
/dev/sda5 906 1032 1020096 83 Linux
/dev/sda6 1033 1096 514048+ 82 Linux swap / Solaris
/dev/sda7 1097 1109 104391 83 Linux
Step2: [root@localhost bash]# fdisk /dev/sda
The number of cylinders for this disk is set to 1305.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help):
Step3: Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
Step4: Command (m for help): n ( n add a new partition)
First cylinder (1110-1305, default 1110):
Step5: First cylinder (1110-1305, default 1110):
Using default value 1110
Last cylinder or +size or +sizeM or +sizeK (1110-1305, default 1305): +100M (We are adding 100MB partitions)
Step6: Command (m for help): p
Disk /dev/sda: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000030ad
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 523 4096575 83 Linux
/dev/sda3 524 905 3068415 83 Linux
/dev/sda4 906 1305 3213000 5 Extended
/dev/sda5 906 1032 1020096 83 Linux
/dev/sda6 1033 1096 514048+ 82 Linux swap / Solaris
/dev/sda7 1097 1109 104391 83 Linux
/dev/sda8 1110 1122 104391 83 Linux (This is the new partitions we have created)
Step7: Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
Step8: Reboot the system
Step9: Creating the file system
[root@localhost ~]# mke2fs -j /dev/sda8 (If we dont give -j it will create ext2 based file system)
mke2fs 1.40.2 (12-Jul-2007)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
26104 inodes, 104388 blocks
5219 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
13 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
Step10: Temporarily mount the partition
[root@localhost ~]# mount /dev/sda8 /mnt
Step11: If we want permanent mounting or the mounting exist after reboot we need the entry in /etc/fstab
/dev/sda8 /mnt ext3 defaults 0 0
Step12:
[root@localhost ~]# mount
/dev/sda3 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda5 on /var type ext3 (rw)
/dev/sda2 on /usr type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/dev/sr0 on /media/Fedora 8 i386 DVD type iso9660 (ro,nosuid,nodev,uhelper=hal,uid=0)
/dev/sda7 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)
/dev/sda8 on /mnt type ext3 (rw) After that we see that mounted partitions
Step13: If we create a partitions having filesystem which is ext2 based we can convert it to ext3 by using following command
tune2fs -j /dev/sda8
Labels: fdisk, linux, partitions


0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home