Linux - The fdisk command

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

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
Published by jak58. Latest update on November 16, 2015 at 05:06 AM by pintuda.
This document, titled "Linux - The fdisk command," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (
Installing a web server (Apache, PHP and MySQL) under Linux
Linux - Scheduling tasks