Disk partitioning

From Wikipedia, the free encyclopedia

In computer engineering, hard disk drive partitioning is the creation of logical divisions upon a hard disk that allows one to apply operating system-specific logical formatting. In layman's terms, partitioning a hard drive makes it appear to be more than one hard drive, especially in how each partition is formatted for different operating systems, and in how files are copied from one partition to another.

Contents

[edit] Purpose

Partitioning allows the creation of several file systems on a single hard disk. This has many benefits, including:

  • Allowing for dual boot setups (for example, to boot Microsoft Windows and Linux), which means the user can have more than one operating system on his/her computer.
  • Sharing swap partitions between multiple Linux distributions, which means less hard drive space is used by Linux swap partitions.
  • Protection or isolation of files, which means if the operating system stops working, it can just be reinstalled without, hopefully, deleting the user's personal files and settings.
  • Raising overall computer performance. Hard drives with one partition have very large MFT Tables and are generally slower than hard drives with multiple partitions.
  • Higher level of data organization increasing the user efficiency of the system, for example a partitioned drive dedicated to digital movie processing.

Partitions may be customized to different requirements, for example, allowing for read-only partitions to protect data - if one partition is damaged, none of the other file systems are affected, and the drive's data may still be salvageable.

[edit] Types of partitions

This section describes partitions as used in MS-DOS, Microsoft Windows and Linux; for partitions as used in other operating systems, see Slice (disk) and BSD disklabel.

[edit] Primary

A primary partition contains one file system. In MS-DOS and earlier versions of Microsoft Windows systems, the first partition (C:) must be a "primary partition". Other operating systems may not share this limitation; however, this can depend on other factors, such as a PC's BIOS.

Technically, a hard disk may contain as many as four primary partitions, however, typically only the active one shows up in the fdisk command.

[edit] Extended

An extended partition is secondary to the primary partition(s). A hard disk may contain only one extended partition; which can then be sub-divided into logical drives, each of which is (under DOS and Windows) assigned additional drive letters.

In DOS and Windows, for example, a hard disk with one primary partition and one extended partition, the latter containing two logical drives, would typically be assigned three drive letters: C:, D: and E:.

Extended partitions are useful if you want more than four partitions on a single physical drive. Technically, the number of logical drives is not limited, but under Windows there is an effective limit if they are to be assigned drive letters (C: through Z:, 24 letters, are available, going to A-A: A-B: A-C: on later operating systems to allow more drives to be connected).

See Extended Boot Record for information on the contents of an extended partition.

[edit] Compressed Hard Disks

Hard disks are sometimes compressed to create additional space. Under DOS and early Windows, programs such as STACKER (DR DOS except 6), SuperStor (DR DOS 6), DoubleSpace, or DriveSpace (Windows 95) were used. This compression was accomplished by creating a very large file on the partition, then storing the hard 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. (SuperStor required a separate device driver to be loaded, DEVSWAP.COM).

Versions of Windows using the NT kernel and Vista contain intrinsic disk compression capability, and the use of separate compression utilities has declined sharply.

[edit] Partitioning schemes

[edit] Microsoft Windows

With Microsoft Windows, the standard partitioning scheme is to create a single active primary partition, the C: drive, where the operating system, user data, applications, and page file all reside. Some users, however, prefer to create multiple partitions so that the operating system can be stored separately from other kinds of data. While this scheme generally results in slightly lower performance due to additional work needing to be done by both the hard drive and the operating system[citation needed], proponents of multiple partitions generally point to the benefit of being able to erase a single partition (typically the operating system itself) while retaining the other data. When used in conjunction with 3rd-party partition management programs such as net-runna Enterprise, Acronis True Image, diskdump, PowerQuest PartitionMagic or Norton Ghost, the use of multiple partitions allows computer users to quickly recover from viruses, rootkits, and trojan horses or an otherwise damaged, corrupt or compromised operating system.

[edit] UNIX systems

For UNIX-based and Unix-like operating systems such as Linux and Mac OS X, the creation of separate partitions for /boot, /home, /tmp, /usr, /var, /opt, swap and all remaining files under the "/" (root directory) is possible. (The same is true for Sun-based operating systems, except their partitions are called slices.) Such a scheme has a number of potential advantages: if one file system gets corrupted, the rest of the data (the other file systems) stay intact, minimizing data loss; partitions can be accessed read-only and the execution of setuid files disabled thus enhancing security; performance may be enhanced due to less disk head travel. However, this method has the disadvantage of subdividing the drive into fixed-size partitions, so, for instance, a user could run out of hard drive space in his or her /home partition, even though other partitions still have plenty of usable space. A good implementation requires the user to predict how much space each partition will need, which may be a difficult task; especially for new users. Logical Volume Management, often used in servers, introduces a degree of flexibility by allowing data in these volumes to expand into separate physical disks (which can be added when needed); another option is to resize existing partitions when necessary. Typical desktop systems, though, are often comprised of a single "/" (root directory) containing the entire filesystem plus a much smaller swap partition. A separate /home partition, however, can be very useful, since it allows for a clean reinstall of the OS (or a fresh install of another Linux distribution) while leaving the user's data intact.

[edit] See also

Wikibooks
Wikibooks Guide to Unix has a page on the topic of

[edit] Further reading

[edit] External links