Disk partitions

Almost every operating system supports a system for dividing a disk into logical devices, called partitions. Other terms for the same basic concept are slices and logical volumes, although logical volumes generally also imply the ability to span physical disks. Linux supports several different partitioning formats, but by default it uses the MS-DOS format. The MS-DOS partition table allows for up to four primary partitions. One of these four primary partitions can be replaced with an extended partition, which can contain up to 12 logical partitions, for a total of 15 possible usable partitions (16 if you count the extended partition “container,” but it is not usable for data).

The type of partition (as well as the type of device) affects the name of the device Linux uses to access the partition.

Primary partitions

This type of partition contains a filesystem. If all four primary partitions exist on an IDE drive, they are numbered as follows:

  • /dev/hda1

  • /dev/hda2

  • /dev/hda3

  • /dev/hda4

One of these primary partitions may be marked active, in which case the PC BIOS will be able to select it for boot.

Extended partitions

An extended partition is a variant of the primary partition but cannot contain a filesystem. Instead, it contains logical partitions. Only one extended partition may exist on a single physical disk. For example, the partitions on a disk with one primary partition and the sole extended partition might be numbered as follows:

  • /dev/hda1 (primary)

  • /dev/hda2 (extended) ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.