fdisk command and its examples

In Linux operating systems fdisk command is used for disk partitioning. Which enables system administrator to create, delete, modify, and manage disk partitions on the system. It comes from util-linux-ng-x.x.x package.


1. To set the sector size of a disk

$ fdisk -b 1024 /dev/sdd

2. To specify the number of cylinders of the disk

$ fdisk -C 1024 /dev/sdb

3. To Specify the number of heads of the disk.

$ fdisk -H 1024 /dev/sdb

4. To Specify the number of sectors per track of the disk.

$ fdisk -S sects /dev/sdb

5. To list the partition tables for the specified devices and then exit

$ fdisk -l
$ fdisk -l /dev/sdb 

6. To get the size of a particular disk

$ fdisk -s /dev/sdb

7. To switch off DOS-compatible mode

$ fdisk -c

8. To get the help for fdisk

$ fdisk -h

9. To get the version of the fdisk

$ fdisk -v

Related Commands: cfdisk, sfdisk, mkfs, parted, partprobe, kpartx 

fdisk command not found

If incase while working on a Linux system, you receive a message that the “fdisk command not found”, that means the below package is not present or installed on system. Hence please follow below commands to install it.

OS VersionCommand to Install
RedHat / CentOS / Fedorayum install util-linux-ng
Debian / Ubuntu / Kubuntuapt install util-linux

Leave a Reply

Your email address will not be published. Required fields are marked *