What is a Partition

Posted On 2007-07-12 by FortyPoundHead
Keywords: Partition Definition
Tags: General Tutorial Linux Windows
Views: 1539

A partition is a logical division on a hard disk drive (HDD).

HDDs are the main storage device on most computers. Storage refers to devices or media that can retain data for relatively long periods of time, in contrast with memory, whose contents can be accessed (i.e., read and written to) at extremely high speeds but which are retained only temporarily (i.e., while in use or only as long as the power supply remains on). A HDD contains several thin metal platters that rotate at high speed while data is being written to and read from a magnetic coating on them by magnetic heads. The disks are housed in a metal case and are not removable, in contrast to floppy disks.

The desired number and sizes of partitions can be easily created on a HDD during the installation of an operating system. New partitions can also be created after the operating system has been installed by using available free space (i.e., space that has not yet been partitioned) or by erasing existing partitions to create free space.

An entire operating system can be installed on a single, unpartitioned HDD, and this is often done with the Microsoft Windows operating systems. However, the ability to divide a HDD into multiple partitions offers some important advantages. They include:

  1. A way for a single HDD to contain multiple multiple operating systems. Although there are other ways to have multiple operating systems on a single computer, such as by having multiple HDDs, it is often the most convenient and/or economical to have them all on the same HDD.

  2. The ability to encapsulate data. Because filesystem corruption is local to a partition, the ability to have multiple partitions makes it likely that only some data will be lost if one partition becomes damaged. It also allows the contents of one partition to be reinstalled without affecting the contents of other partitions. For example, if the operating system becomes corrupted and needs to be reinstalled, having data on one or more separate partition means that the data on those partitions will not be affected during reinstallation of the operating system.

  3. Some filesystems (e.g. old versions of the Microsoft FAT filesystem) have size limits that are far smaller than modern HDDs. Thus, multiple filesystems make it possible to use more of the HDD.

  4. Prevent runaway processes and overgrown log (and other) files from consuming all the spare space on the HDD and thus making the entire HDD, and thus the entire computer, unusable. Separate partitions ensure that such processes and files will limit their total disk space consumption to individual partitions at most.

  5. Simplify the backing up of data. Partition sizes can be made sufficiently small that they fit completely on one unit of backup medium for a daily or other periodic backup.

  6. Increase disk space efficiency. Partitions can be formatted with varying block sizes, depending on usage. If the data is in a large number of small files (less than one kilobyte) and the partition uses 4KB sized blocks, 3KB is being wasted for every file. In general, on average one half of a block is wasted for every file, so matching block size to the average size of the files is important if there are many files.

There are several constraints on partitions: (1) they cannot overlap, as this would cause data corruption and other problems, (2) they cannot be moved, although they can be resized and copied, (3) there should be no gap between adjacent partitions, because it wastes disk space, and (4) disks need not be partitioned completely, i.e., unpartitioned space can be left at the end of a disk to partitioned at a later date if desired.

Although partitions are logically independent, they become logically connected when they are mounted, i.e., attached to the main filesystem. This can be accomplished automatically when the system is booted (i.e., started up) or manually by using the mount command.

On Microsoft operating systems, i.e., MS-DOS and the various Windows systems, each HDD and each of its partitions as well as each other storage device is designated by a drive letter. The first partition on the first HDD is always represented by C:, and subsequent letters such as D: and E: can represent other partitions or other devices such as other disk drives.

There are several ways that information about partitions can be obtained on Linux and other Unix-like operating systems. Perhaps the easiest is to use df command, although this shows only those partitions that are currently mounted (i.e., attached to the system). It is particularly convenient to use this command with its -h (i.e., human readable) option, i.e.,

df -h

fdisk is a more powerful command that not only shows all of the partitions on the system (not only just those currently mounted), but which also can be used to change them. Thus it can be dangerous (e.g., render a system inoperable), and, consequently, on most systems only the root account (i.e., administrative user) is permitted to use it.

On systems in which an ordinary user is permitted to become the root user, such as a home computer, the switch to root can be accomplished easily using the su command. Then fdisk can be used to access the desired HDD, with the first HDD designated by /dev/hda, the second designated by /dev/hdb (for a computer which has a second HDD), etc. Thus, the following would access the first HDD:

/sbin/fdisk /dev/hda

The partition table for the designated HDD can then be viewed by typing the letter p and pressing the ENTER key. Typing the letter m provides a menu of commands.

About the Author

has posted a total of 1974 articles.

Comments On This Post

No comments on this post yet!

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.

Your IP address is:

Before you can post, you need to prove you are human. If you log in, this test goes away.

Code Links