Partitioning drives
Feb 11, 2009 by mohamed hanoosh
fdisk is used for partitioning disks. It can be used for creating , deleting partitions , change fs type, labelling etc. It can be executed only as a privileged user. Simply type fdisk followed by the device file name as shown
Different operations needed can be specified here. To get a list of possible operation press 'm'.
* Only primary partitions have bootable property (OS can be installed in any partition as long as its boot loader is kept in some bootable location). A hard disk can have a maximum of four primary partition. To create more partition a partition called extended partition is to be created ( this will be counted as one primary partition ). Inside this extended partition many logical partitions can be created.
GUI is available for modifying the partition table. In SUSE they have their own GUI which can be found in Yast control center. In general gparted (Gnome) and qtparted are used as GUIs.
$ fdisk /dev/sda
The number of cylinders for this disk is set to 30394.
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):
Different operations needed can be specified here. To get a list of possible operation press '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)
Command (m for help):
- To create a new partition
- Type fdisk followed by device file name as shown above.
- Press 'n' for creating a new partition.
- It will ask for partition type ( logical / primary )* . Select which ever is needed.
- Give the partition number
- Give the first cylinder number . Press Enter for default value.
- Give the last cylinder or the size required . For eg; +1024M for 1GB. Here also press Enter for default value
- To change file system type of the partition, press 't'
- Give the partition number
- Give hexcode of the required fs type ( press 'L' to get list of all fs types ).
- Press 'w' for writing the changes to disk. ( To exit without any change to partition table press 'q' ).
- To delete a partition
- Type fdisk followed by device name as shown above.
- Press 'n' for deleting a partition.
- Give the partition number
- Press 'w' for writing the changes to disk. ( To exit without any change to partition table press 'q' ).
- Type fdisk followed by device name as shown above.
The sequence of commands required are given below
* Only primary partitions have bootable property (OS can be installed in any partition as long as its boot loader is kept in some bootable location). A hard disk can have a maximum of four primary partition. To create more partition a partition called extended partition is to be created ( this will be counted as one primary partition ). Inside this extended partition many logical partitions can be created.
GUI is available for modifying the partition table. In SUSE they have their own GUI which can be found in Yast control center. In general gparted (Gnome) and qtparted are used as GUIs.