thumb|272x272px|[[GParted is a popular utility used for disk partitioning]]

Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk after a partitioning scheme is chosen for the new disk before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

History

One of the earliest such forms of segmentation of a disk drive was IBM's 1966

IBM in its 1983 release of PC DOS version 2.0 also used the term partition to describe dividing a block storage device such as an HDD into physical segments. The term's usage is now ubiquitous. Other terms used include logical disk,

Partition recovery

When a partition is deleted, its entry is removed from a table and the data is no longer accessible. The data remains on the disk until it is overwritten. Specialized recovery utilities may be able to locate lost file systems and recreate a partition table which includes entries for these recovered file systems. Some disk utilities may overwrite a number of beginning sectors of a partition they delete. For example, if Windows Disk Management (Windows 2000/XP, etc.) is used to delete a partition, it will overwrite the first sector (relative sector 0) of the partition before removing it. It still may be possible to restore a FAT or NTFS partition if a backup boot sector is available.

Compressed disks

HDDs can be compressed to create additional space. In DOS and early Microsoft Windows, programs such as Stacker (DR-DOS except 6.0), SuperStor (DR DOS 6.0), DoubleSpace (MS-DOS 6.0–6.2), or DriveSpace (MS-DOS 6.22, Windows 9x) were used. This compression was done by creating a very large file on the partition, then storing the disk's data in this file. At startup, device drivers opened this file and assigned it a separate letter. Frequently, to avoid confusion, the original partition and the compressed drive had their letters swapped, so that the compressed disk is C:, and the uncompressed area (often containing system files) is given a higher name.

Versions of Windows using the NT kernel, including the most recent version, Windows 11, contain intrinsic disk compression capability. Despite advancements in processing power and more efficient and transparent compression methods, the use of separate disk compression utilities has declined sharply. Modern compressing utilities include CompactGUI and CompressorX.

Partition table

A partition table is a table maintained on a disk by the operating system that outlines and describes the partitions on that disk. The terms partition table and partition map are similar terms and can be used interchangeably. The term is most commonly associated with the MBR partition table of a Master Boot Record (MBR) in PCs, but it may be used generically to refer to other formats that divide a disk drive into partitions, such as: GUID Partition Table (GPT), Apple partition map (APM), or BSD disklabel.

Here is an example of GUID Partition Table for a 512GB NVM Express solid state drive as used with multi-boot configuration, containing an EFI system partition, a Microsoft Reserved Partition, three Microsoft Basic Data Partitions (one is Windows standard partition and two are hidden Windows Recovery Environment partitions), and three Linux partitions (including a swap partition):

<syntaxhighlight lang="sh">

label: gpt

label-id: 96BB56B7-AE3C-4E94-986E-10E7F3CCA80B

device: /dev/nvme0n1

unit: sectors

first-lba: 34

last-lba: 1000215182

sector-size: 512

/dev/nvme0n1p1 : start= 2048, size= 532480, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=7885D52E-0F50-4E28-B058-8DCE7B7FF921, name="EFI system partition"

/dev/nvme0n1p2 : start= 534528, size= 32768, type=E3C9E316-0B5C-4DB8-817D-F92DF00215AE, uuid=5C34D099-E77A-4B46-9662-430D33E55AFF, name="Microsoft reserved partition"

/dev/nvme0n1p3 : start= 567296, size= 419196928, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=109218B1-3097-4635-BE5F-044E28C2BCB0, name="Basic data partition"

/dev/nvme0n1p4 : start= 419764224, size= 1669120, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=527B26E5-2768-444E-AB1F-ECB28201F3C8, attrs="RequiredPartition GUID:63"

/dev/nvme0n1p5 : start= 421435392, size= 329410560, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=5C52E480-AEE7-437B-A136-53F8C946D5ED, name="Linux Stuff"

/dev/nvme0n1p6 : start= 750845952, size= 243933184, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=023F3B88-D3D9-4E39-9F50-77F242410789, name="Linux Root"

/dev/nvme0n1p7 : start= 994779136, size= 4194304, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F, uuid=18F44D65-B28D-4871-AF02-DDBD96771460, name="Swap"

/dev/nvme0n1p8 : start= 998973440, size= 1228800, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=D4A41B1A-2F28-4AE5-AC67-A2D98FB91E22, name="Basic data partition", attrs="RequiredPartition GUID:63"

</syntaxhighlight>

PC partition types

MBR

This section describes the master boot record (MBR) partitioning scheme, as used historically in DOS, Microsoft Windows and Linux (among others) on PC-compatible computer systems. As of the mid-2010s, most new computers use the GUID Partition Table (GPT) partitioning scheme instead. For examples of other partitioning schemes, see the general article on partition tables.

The total data storage space of a PC HDD on which MBR partitioning is implemented can contain at most four primary partitions, or alternatively three primary partitions and an extended partition. The Partition Table, located in the master boot record, contains 16-byte entries, each of which describes a partition.

The partition type is identified by a 1-byte code found in its partition table entry. Some of these codes (such as and ) may be used to indicate the presence of an extended partition. Most are used by an operating system's bootloader (that examines partition tables) to decide if a partition contains a file system that can be mounted / accessed for reading or writing data.

Primary partition

A primary partition contains one file system. In DOS and all early versions of Microsoft Windows systems, Microsoft required what it called the system partition to be the first partition. All Windows operating systems from Windows 95 onwards can be located on (almost) any partition, but the boot files (<code>io.sys</code>, <code>bootmgr</code>, <code>ntldr</code>, etc.) must reside on a primary partition. However, other factors, such as a PC's BIOS (see Boot sequence on standard PC) may also impose specific requirements as to which partition must contain the primary OS.

The partition type code for a primary partition can either correspond to a file system contained within (e.g., means either an NTFS or an OS/2 HPFS file system) or indicate that the partition has a special use (e.g., code usually indicates a Linux swap partition). The FAT16 and FAT32 file systems have made use of a number of partition type codes due to the limits of various DOS and Windows OS versions. Though a Linux operating system may recognize a number of different file systems (ext4, ext3, ext2, ReiserFS, etc.), they have all consistently used the same partition type code: (Linux native file system).

Extended partition

An HDD may contain only one extended partition, but that extended partition can be subdivided into multiple logical partitions. DOS/Windows systems may then assign a unique drive letter to each logical partition. GUID partition table (GPT) only has the primary partition, doesn't have the extended partition and the logical partition.

Boot partitions

BIOS boot partition

BIOS boot partition (BIOS BP) is a share of the storage device used to keep software that boots the operating system, a bootloader. It may be an operating system kernel image or bootloader or a completely separate piece of software.

EFI system partition

EFI system partition is the same as BIOS BP, but is loaded by EFI firmware instead of BIOS.

Further reading