From LQWiki
Jump to: navigation, search

A partition is a logical section of a hard disk and a practical way for users to divide their disks up into parts that behave as independent, separate devices, which in reality reside on one hard disk. A partition is technically defined in the partition table of a hard disk.

Why partition?

Partitioning has several advantages and disadvantages.


Most practically, partitioning allows you to set up different operating systems on a single disk. If you have successfully installed any multiple-boot system, say, with Linux, partitioning allows the different operating systems to coexist and not interfere.

Managing hard disk space

Partitioning also alleviates the problem of managing hard disk space, especially within a multi-user system. For example, when a multi-user system is set up, the home directories and the system directories often reside on different partitions. Without partitioning the disk in this way, or without setting up adequate disk quota systems, a user can fill up the partition and render the system unusable. Separating respective directories by usage into partitions can assist in alleviating space issues.

Problems with partitioning

Partitioning a disk is a rather low-level operation, and if it fails, valuable data can get lost. Performing partitioning requires a high grade of technical proficiency and accuracy without the use of the right tools.

Partition Topology

Types of partitions

As for types of partitions we know "Primary", "Extended" and "Logical" partitions. The basic types are Primary and Logical, where Extended appears as a special case of a Primary partition. A disk can only have maximum 4 Primary but never more than 1 Extended partition. A certain amount of Logical partitions (also called "Logical Drives") can be defined within the Extended partition. Primary and Logical partitions are addressable for disk space whereas Extended is only a nominal entry in the partition-table representing the set of its Logical partitions.


Linux reserves hda1, hda2, hda3 and hda4 for the 4 primary partitions and the first logical partition always starts with hda5. Windows counts through all addressable partitions by drive letters starting from "C" (C,D,E,...).


In Windows the total number of partitions is limited by the 26 alphabets. Linux permits 63 partitions in an IDE disk but only 15 in an SCSI or Sata disk. Some operating system, as e.g. Windows, can only be booted from a Primary partition, Linux can be booted from either a Primary or a Logical partition.


How do I create partitions?

On Linux systems, partitions are managed by programs such as fdisk or cfdisk. It is very dangerous to repartition a running system, and any changes in partitioning can render the data on the affected areas of the disk unusable. You will almost never have to partition unless you are installing a new operating system, or a new hard drive.

What partitions do I need?

Read the Partitioning Guidelines for suggestions on how to divide up your available disk space.

Older versions of LILO required that the boot information for the kernel reside on a partition near the "front" of the disk. Newer versions have eliminated this requirement.

How do I see the partitions on my computer?

You can look at the partition table of the device /dev/hda with:

fdisk -l /dev/hda

You can see all partitions (of all devices) known by the kernel with

hwinfo --partition

You can print the filesystem types in use with:

df -hT

Find out a partition's size

To find out a partition's size in bytes (or megabytes or what may come in the future), use fdisk. Using fdisk on a partition will not print you a partition table, obviously, but it will print you the partition's size like this:

fdisk -l /dev/sdc1

Disk /dev/sdc1: 80.0 GB, 80023716864 bytes
255 heads, 63 sectors/track, 9728 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

     Device Boot      Start         End      Blocks   Id  System

In this example, we find out /dev/sdc1 has a size of 80.0 GB.

See also