Disk partitioning is the act of dividing a hard disk drive (HDD) into multiple logical storage units referred to as partitions, to treat one physical disk drive as if it were multiple disks, so that a different file system can be used on each partition.
A partition editor software program can be used to create, resize, delete, and manipulate these partitions on the HDD. A partition consists of a range of cylinders of HDD—i.e. each partition is defined by both a start and end cylinder (the size of cylinders varying from disk to disk).
- 1 Benefits of multiple partitions
- 2 Disadvantages of multiple partitions
- 3 PC partition types
- 4 Partitioning schemes
- 5 Partition recovery
- 6 Compressed disks
- 7 See also
- 8 References
- 9 Further reading
- 10 External links
Benefits of multiple partitions
Creating more than one partition has the following advantages:
- Separation of the operating system (OS) and program files from user files. This allows image backups (or clones) to be made of only the operating system and installed software.
- Having a separate area for operating system virtual memory swapping/paging.
- Keeping frequently used programs and data near each other.
- Having cache and log files separate from other files. These can change size dynamically and rapidly, potentially making a file system full.
- Use of multi-boot setups, which allow users to have more than one operating system on a single computer. For example, one could install Linux, BSD, Mac OS X, Microsoft Windows or other operating systems on different partitions of the same HDD and have a choice of booting into any compatible operating system at power-up.
- Protecting or isolating files, to make it easier to recover a corrupted file system or operating system installation. If one partition is corrupted, other file systems may not be affected.
- Raising overall computer performance on systems where smaller file systems are more efficient. For instance, large HDDs with only one NTFS file system typically have a very large sequentially accessed Master File Table (MFT) and it generally takes more time to read this MFT than the smaller MFTs of smaller partitions.
- "Short stroking", which aims to minimize performance-eating head repositioning delays by reducing the number of tracks used per HDD. The basic idea is that you make one partition approx. 20–25% of the total size of the drive. This partition is expected to: occupy the outer tracks of the HDD, and offer more than double the throughput — less than half the access time. If you limit capacity with short stroking, the minimum throughput stays much closer to the maximum. This technique, however, is not related to creating multiple partitions, but generally just creating a partition less than the disk size.
- For example, a 1 TB disk may have an access time of 12 ms at 200 IOPS (at a limited queue depth) with an average throughput of 100 MB/s. When it is partitioned to 100 GB (and the rest left unallocated) access time may be decreased to 6 ms at 300 IOPS (with a bigger queue depth) with an average throughput of 200 MB/s.
- Partitioning for significantly less than the full size available when disk space is not needed can reduce the time for diagnostic tools such as checkdisk to run or for full image backups to run.
Disadvantages of multiple partitions
Creating more than one partition has the following disadvantages, as compared to having a single partition spanning the same disk area:
- Reduces the total space available for user storage on the disk, as it forces the operating system to duplicate certain file system administration areas on the disk for each partition.
- Reduces overall disk performance on systems where data is accessed regularly and in parallel on multiple partitions, because it forces the disk's read/write head to move back and forth on the disk to access data on each partition and to maintain and update file system administration areas on each partition. It also prevents disk optimizers from moving all frequently accessed files closer to each other on the disk, which could reduce the number and distance of required head movements. Files can still be moved closer to each other on each partition, but those areas themselves will still be far apart on the disk. (See "short stroking" considerations above.) This issue does not apply to Solid-state drives as access times on those are neither affected by nor dependent upon relative sector positions.
- Increases disk fragmentation because it lowers the average size of contiguous free blocks on each partition - as compared to a single partition of the same overall size - after the same amount of data has been written to them.
- May prevent using the whole disk capacity, because it may break free capacities apart. For example, if one has a disk with two partitions, each with 3 GB free (hence 6 GB in total), one can't copy a 4 GB DVD image file on that disk, because none of the partitions will actually provide enough space for that - even though there is more than enough free capacity in total on the disk. If the same files on those two partitions would have been stored on a single partition spanning the whole disk, then the 4 GB file could be easily stored in the 6 GB of free space.
- Hurts portability and might impose constraints on how entities might be linked together inside the file system. For example, Unix file systems and the NTFS file system allow hard links to be created only as long as both the link and the referenced file reside inside the same volume/partition. Also, under Windows if one is referencing a file on another partition, one can do that only by specifying the partition's assigned drive letter (or mount point) - which, however, might change with time and depending on the drives installed. This renders references invalid and dependent on actual drive letter assignment, which is not an issue if one has to reference files/directories only on the same partition, as in this case one can use directory-relative or root-relative references, without including the drive/partition letter.
PC partition types
This section describes the master boot record (MBR) partitioning scheme, as used in DOS, Microsoft Windows and Linux (among others) on PC-compatible computer systems. For examples of partitioning schemes used in other operating systems, see the general article on partition tables.
The total data storage space of a PC HDD 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 0x05 and 0x0F) 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 used to mount / access for reading or writing data.
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 (
ntldr, 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. 0x07 means either an NTFS or an OS/2 HPFS file system) or indicate that the partition has a special use (e.g. code 0x82 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: 0x83 (Linux native file system).
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.
DOS, Windows, and OS/2
With DOS, Microsoft Windows, and OS/2, a common practice is to use one primary partition for the active file system that will contain the operating system, the page/swap file, all utilities, applications, and user data. On most Windows consumer computers, the drive letter C: is routinely assigned to this primary partition. Other partitions may exist on the HDD that may or may not be visible as drives, such as recovery partitions or partitions with diagnostic tools or data. (Microsoft drive letters do not correspond to partitions in a one-to-one fashion, so there may be more or fewer drive letters than partitions.)
Microsoft Windows 2000, XP, Vista, and Windows 7 include a 'Disk Management' program which allows for the creation, deletion and resizing of FAT and NTFS partitions. The Windows Disk Manager in Windows Vista and Windows 7 utilizes a new 1 MB partition alignment scheme which is fundamentally incompatible with Windows 2000, XP, OS/2, DOS as well as many other operating systems.
On Unix-based and Unix-like operating systems such as GNU/Linux, OS X, BSD, and Solaris, it is possible to use multiple partitions on a disk device. Each partition can be formatted with a file system or as a swap partition.
- If one file system gets corrupted, the data outside that filesystem/partition may stay intact, minimizing data loss.
- Specific file systems can be mounted with different parameters e.g. read-only, or with the execution of setuid files disabled.
- A runaway program that uses up all available space on a non-system filesystem does not fill up critical filesystems.
By default, OS X systems also use a single partition for the entire filesystem and use a swap file inside the file system (like Windows) rather than a swap partition.
In Solaris, partitions are sometimes known as slices. This is a conceptual reference to the slicing of a cake into several pieces.
The term "slice" is used in the FreeBSD operating system to refer to Master Boot Record partitions, to avoid confusion with FreeBSD's own disklabel-based partitioning scheme. However, GUID Partition Table partitions are referred to as "partition" world-wide.
Multi-boot and mixed-boot systems
Multi-boot systems are computers where the user can boot into one of two or more distinct operating systems (OS) stored in separate storage devices or in separate partitions of the same storage device. In such systems a menu at startup gives a choice of which OS to boot/start (and only one OS at a time is loaded).
This is distinct from virtual operating systems, in which one operating system is run as a self-contained virtual "program" within another already-running operating system. (An example is a Windows OS "virtual machine" running from within a Linux OS.)
GUID Partition Table
The GUID Partition Table (Globally Unique IDentifier) is a part of the Unified Extensible Firmware Interface (UEFI) standard for the layout of the partition table on a physical hard disk. Many operating systems now support this standard.
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 being overwritten. Specialized recovery utilities, (such as TestDisk and gpart), 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.
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, or DriveSpace (Windows 95) 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 versions, XP and Vista, contain intrinsic disk compression capability. The use of separate disk compression utilities has declined sharply.
- File System
- RAID, JBOD
- Disk formatting
- Master boot record covers the partition table layout
- Extended boot record covers a Linux partition naming convention
- Amiga Rigid Disk Block
- List of disk partitioning software
- Partition alignment
- Mueller, Scott (2003). Upgrading and Repairing PCs. Que Publishing. p. 613. ISBN 9780789729743.
- Partitions are also termed "slices" for operating systems based on BSD, Solaris or GNU Hurd.
- Ward, Brian (2004). How Linux Works: What Every SuperUser Should Know. No Starch Press. p. 39. ISBN 9781593270353.
- Schmid, Patrick; Roos, Achim (2009-03-05). "Accelerate Your Hard Drive By Short Stroking". Tomshardware.com. Retrieved 2012-10-24.
- Kozierok, Charles M. (2001-04-17). "Partitioning and Volume Position". Pcguide.com. Retrieved 2012-10-24.
- Blake, Ken. "Understanding Disk Partitioning". Computorcompanion.com. Retrieved 2012-10-24.
- Smith, Roderick W. (2000-03-01). The Multi-Boot Configuration Handbook. QUE. p. 178. ISBN 0-7897-2283-6. Retrieved 2012-10-24.
- Linux Programmer's Manual – System Calls –
- BSD System Calls Manual –
- Solaris 10 System Calls Reference Manual –
- "CreateHardLink function". Microsoft. 2013-04-16. Retrieved 2013-06-19.
- Stéphane Martineau, Jens Olsson, Nick Roberts (2002-11-02). "The Alt-OS-Development Partition Specification (AODPS)". 0.4.
- Andries Brouwer (1995–2004). "List of partition identifiers for PCs".
- Andries Brouwer (1999-09-16). "Minimal Partition Table Specification".
- "partitioning primer". Ranish. 1998-08-05.
- Allen Smith. "ATA (EIDE) Drive Capacity and Addressing".
- Microsoft (2005-06-03). "Using GPT Drives".
- "MS-DOS Partitioning Summary". Support. Microsoft.
|The Wikibook Guide to Unix has a page on the topic of: Partitioning Disks|
- Linux Partition HOWTO
- Partition Definition - by The Linux Information Project (LINFO)
- Multiple OS Installation in multiple partitions—guide to using chainloaded bootloaders to enable multiple OSs to coexist
- Partition Types
- Properties of partition tables
- List of partition tables file system codes.
- Guide with advantages and disadvantages to disk partitioning