Linux - The fdisk command

Ask a question

Linux - The fdisk command



The Linux fdisk utility allows you to create partitions on your hard drive in the same way as its MS-DOS counterpart. It should be noted that the Linux version of fdisk is more complicated to use than MS-DOS version, so it is advisable to create partitions from MS-DOS (create a system disk in order to format the DOS partition and install DOS kernel after installing Linux)
  • Partitioning with fdisk will lead to the lost of all data on the concerned disk.
  • To invoke the utility use the fdisk command. When no argument is added, fdisk will select the first drive it finds.
  • Pass the device name as an argument to select the drive/partition of your choice (e.g the second hard drive will be selected):
    • fdisk /dev/hdb

The naming conventtion for hard disks

Under Linux, the name of the storage devices varies depending on whether they are SCSI or IDE drives.
  • For IDE drives, the first is named hda, the second one is named hdb .
  • For SCSI disks, the first will be called sda, the second one is named sdb .

fdisk Commands


CommandDescription
ddelete partition
llist the partition types
mPrint current menu
ncreating a new partition
pDisplay partitions
qexit fdisk without saving settings
tchange the partition type
vCheck the partition table
wSave changes and exit fdisk


Original document published on CommentcaMarche.net.
Jean-François Pillou

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Learn more about the CCM team