Fdisk is the best tool to manage disk partitions. Using fdisk you can create a new partition, delete one, and change existing partitions. There are other tools you can use I found the fdisk to be easy to use.
To list all the drives in the system
# fdisk -l
# fdisk -l /dev/sdb
Warning: When you use fdisk command please be sure to backup all your data, because everything will be lost.
To create a partition to the newly added disk
1) # fdisk /dev/sdb (or whatever disk name you have)
Fdisk has simple navigation once you are inside it, as long as you know core functions in it.
Once you are inside the fdsik mode after running 1) fdisk would be offering m option for help if you need any.
m - print help menu
p - print the partition table
l - list known partitions
n - add a new partition
When you have selected n option there are some extra steps to work on
it will ask you to choose if it is -- extended or -- primary partition
select whichever you like mostly (p) primary
select partition number
then it will prompt to minimum start size of the disk
after selecting min size it will ask you max size of the disk
By default it will create a Linux partition 83 you can change it by option (t) and use 82 for swap so on
w - this command writes all the changes (please make sure and verify with (v) and (p) options. This would be your last chance to check before it writes all the changes you have made.
After you have created the partition, now you have to format the partition
# mkfs.ext4 /dev/sdbX
To list all the drives in the system
# fdisk -l
# fdisk -l Disk /dev/sda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0xf6edf6ed Device Boot Start End Blocks Id System /dev/sda1 1 1959 15735636 c W95 FAT32 /dev/sda2 1960 5283 26700030 f W95 Ext'd /dev/sda3 5284 6528 10000462+ 7 HPFS/NTFS /dev/sda4 6529 9729 25712032+ c W95 FAT32 /dev/sda5 * 1960 2661 5638752 83 Linux /dev/sda6 2662 2904 1951866 83 Linux /dev/sda7 2905 3147 1951866 83 Linux /dev/sda8 3148 3264 939771 82 Linux swap / SolarisYou can list particular disk drive with
# fdisk -l /dev/sdb
Warning: When you use fdisk command please be sure to backup all your data, because everything will be lost.
To create a partition to the newly added disk
1) # fdisk /dev/sdb (or whatever disk name you have)
Fdisk has simple navigation once you are inside it, as long as you know core functions in it.
Once you are inside the fdsik mode after running 1) fdisk would be offering m option for help if you need any.
m - print help menu
p - print the partition table
l - list known partitions
n - add a new partition
When you have selected n option there are some extra steps to work on
it will ask you to choose if it is -- extended or -- primary partition
select whichever you like mostly (p) primary
select partition number
then it will prompt to minimum start size of the disk
after selecting min size it will ask you max size of the disk
By default it will create a Linux partition 83 you can change it by option (t) and use 82 for swap so on
w - this command writes all the changes (please make sure and verify with (v) and (p) options. This would be your last chance to check before it writes all the changes you have made.
# fdisk /dev/sda The number of cylinders for this disk is set to 9729. 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): 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)
After you have created the partition, now you have to format the partition
# mkfs.ext4 /dev/sdbX
No comments:
Post a Comment