Linux - The fdisk command

December 2016


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.

Related :

This document entitled « Linux - The fdisk command » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.