Disk partitioning

GParted is a popular utility used for disk partitioning

Disk partitioning or disk slicing[1] is the creation of one or more regions on a hard disk or other secondary storage, so that an operating system can manage information in each region separately.[2] Partitioning is typically the first step of preparing a newly manufactured disk, before any files or directories have been 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 in 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.[3]When a hard drive is installed in a computer, it must be partitioned before you can format and use it. Partitioning a drive is when you divide the total storage of a drive into different pieces. These pieces are called partitions. Once a partition is created, it can then be formatted so that it can be used on a computer.

Benefits of multiple partitions

Creating more than one partition has the following advantages:

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:

PC partition types

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 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.

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 (io.sys, bootmgr, 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).

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.

Partitioning schemes

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 1 MB partition alignment scheme which is fundamentally incompatible with Windows 2000, XP, OS/2, DOS as well as many other operating systems.

Unix-like systems

On Unix-based and Unix-like operating systems such as Linux, macOS, 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.

Multiple partitions allow directories such as /boot, /tmp, /usr, /var, or /home to be allocated their own filesystems. Such a scheme has a number of advantages:

A common configuration for Linux desktop systems is to use two partitions: one holding a file system mounted on "/" (the root directory) and a swap partition.

By default, macOS 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" worldwide.

Multi-boot and mixed-boot systems

A GRUB startup menu showing Ubuntu Linux (with three different boot modes) and Windows Vista options

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.

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 being overwritten. Specialized recovery utilities, (such as TestDisk, AOMEI Partition Assistant, M3 Partition Recovery[11] 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.

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, 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.

See also

Wikimedia Commons has media related to Disk partitions.

References

  1. Calkins, Bill (2013). Oracle Solaris 11 System Administration.
  2. Levi, Bozidar (2002). UNIX Administration.
  3. Ward, Brian (2004). How Linux Works: What Every SuperUser Should Know. No Starch Press. p. 39. ISBN 9781593270353.
  4. Kozierok, Charles M. (2001-04-17). "Partitioning and Volume Position". Pcguide.com. Retrieved 2012-10-24.
  5. Blake, Ken. "Understanding Disk Partitioning". Computorcompanion.com. Retrieved 2012-10-24.
  6. Smith, Roderick W. (2000-03-01). The Multi-Boot Configuration Handbook. QUE. p. 178. ISBN 0-7897-2283-6. Retrieved 2012-10-24.
  7. link(2)  Linux Programmer's Manual – System Calls
  8. link(2)  BSD System Calls Manual
  9. link(2)  Solaris 10 System Calls Reference Manual
  10. "CreateHardLink function". Microsoft. 2013-04-16. Retrieved 2013-06-19.
  11. "Partition recovery software to recover RAW drive and recover deleted or lost partition".

Further reading

The Wikibook Guide to Unix has a page on the topic of: Partitioning Disks
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.