fdisk – Partition table manipulator for Linux

fdisk [-u] [-b sectorsize] [-C cyls] [-H heads] [-S sects] device

fdisk -l [-u] [device …]

fdisk -s partition …

fdisk -v

Hard disks can be divided into one or more logical disks called partitions.  This division is described in the partition table found in sector 0 of the disk.

In the BSD world one talks about `disk slices’ and a `disklabel’.

Linux needs at least one partition, namely for its root file system.  It can use swap files and/or swap partitions, but the latter are more efficient. So, usually one will want a second Linux partition dedicated as swap par-
tition.  On Intel compatible hardware, the BIOS that boots the system can often only access the first 1024 cylinders of the disk.  For this reason people with large disks often create a third partition, just a few MB  large,
typically mounted on /boot, to store the kernel image and a few auxiliary files needed at boot time, so as to make sure that this stuff is accessible to the BIOS.  There may be reasons of security, ease of administration and
backup, or testing, to use more than the minimum number of partitions.

fdisk (in the first form of invocation) is a menu driven program for creation and manipulation of partition tables.  It understands DOS type partition tables and BSD or SUN type disklabels.

fdisk doesn’t understand GUID Partition Table (GPT) and it is not designed for large partitions. In particular case use more advanced GNU parted(8).

The device is usually one of the following:
(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks, /dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks).  A device name refers to the entire disk.
-b sectorsize
Specify the sector size of the disk. Valid values are 512, 1024, or 2048.  (Recent kernels know the sector size. Use this only on old kernels or to override the kernel’s ideas.)

-C cyls
Specify the number of cylinders of the disk.  I have no idea why anybody would want to do so.

-H heads
Specify the number of heads of the disk. (Not the physical number, of course, but the number used for partition tables.)  Reasonable values are 255 and 16.

-S sects
Specify the number of sectors per track of the disk.  (Not the physical number, of course, but the number used for partition tables.)  A reasonable value is 63.

-l     List the partition tables for the specified devices and then exit.  If no devices are given, those mentioned in /proc/partitions (if that exists) are used.

-u     When listing partition tables, give sizes in sectors instead of cylinders.

-s partition
The size of the partition (in blocks) is printed on the standard output.

-v     Print version number of fdisk program and exit.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: