The Hard Drive Prepping Primer
Robert Spotswood
Partitions, Part I
Introduction

Every hard drive (HD), and this includes external HD’s and flash drives, in use in a modern PC has been partitioned. Some HD’s have many partitions, while others, mostly Windows computers, have only one partition. Whether you do the partitioning or let someone else do it for you, partitioning is usually the first step in preparing a HD for use. A few, such as your author, prefer to test the HD thoroughly to make sure it isn’t bad (rare, but it does happen) before partitioning. Better to find the problem before the HD goes into service than after.
While you can re-partition later if you change your mind about the setup, it is not a quick and simple matter and can cause problems. It's better to spend a little extra time up front and get it right, than to re-partition later.
What Are Partitions?
Partitions are simply sections of a HD, like a drawer in a file cabinet. Like the drawers in a file cabinet, they do represent physical areas of the HD; unlike the drawers in the file cabinet, they can be nearly any size you want. Just as each drawer can have different kinds of folders (single cut, 1/3 cut, etc.) & folder organizers (Pendaflex in different widths, or not), each partition can have a different file system and even a different operating system (OS), but each partition can have only one of each. Trying to install different OS’s on the same partition, even when possible, is a disaster waiting to happen. After a partition is created, it must be formatted before it can be used, and only partitions can be formatted. This formatting process is what creates the file system.
There are two basic types of partitions, primary and extended. Extended is just a special type of primary. Each HD can have at most 4 primary partitions or 3 primary and 1 extended. There can be only one extended partition on any HD. The extended partition can, and must, be further divided into logical partitions. These logical partition(s) can then be formatted and used. You can not format an extended partition. Since Windows will recognize only the first primary and the extended partition (if present) on any hard drive (a problem Linux does not have), you must create one or more logical partitions if you want more than one usable partition per HD in Windows.
Partitions are used to organize your HD. There are many ways to partition a HD, and each scheme has its unique advantages and disadvantages. There is no single right answer. Below are a few of the more common schemes, but this list is by no means exhaustive. Some argue that multiple partitions, not including the swap (paging) space, can improve HD performance by reducing seek and access times, but the jury is still out on that one.
One big partition
Advantages: This is the simplest possible configuration and the easiest to set up. The entire hard drive has only one partition. There is no wasted free space. This is the default for Windows, but rarely used with experienced Linux users except for extra, data only, HD's.
Disadvantages: This mixes your data with the operating system (OS), and you can have only one OS and one file system type. Defragmenting (“defrags”) and disk checking take the longest with this scheme as everything must be checked. You have no chance to make an image copy of your partition without some sort of external storage although that does mean you have some protection against hard drive failure.
Multiple partitions
Advantages: This allows you to keep all your data together on one (or more) partitions, making backups simpler. Just backup the entire partition and you are ALWAYS sure to get everything. Trying to pick individual folders leads to mistakes. The relatively unchanging OS partition doesn't have to be backed up every time and this reduces, or even avoids, doing incremental backups. The simpler and faster backups are to do, the more likely they are to be done and done correctly. This also allows the data partition to have a different file system from the OS partition. There are advantages to that, especially if dual-booting.
Wiping out the old OS to install a fresh copy or new version, e.g. if really persistent malware is clogging your system or for upgrading the OS when a direct upgrade is not supported and/or recommended, is simple since it presents no danger to your data. This one OS partition plus one data partition is the simplest scheme commonly used with Linux. Defragging and disk checking are faster on smaller partitions and the OS partition probably won't need a defrag as often as the data partition.
Having multiple partitions allows you to have two or more (depending on how many partitions you have) OS’s on the same computer (aka dual-booting), although virtual machine software is starting to make this unnecessary.
Disadvantages: The free space is compartmentalized. No matter how much space is available on one partition, another (full) partition cannot use it. This makes the decision of how much space to allocate to each partition very tricky. Don't expect to get it perfect. Just hope you don't get it horribly wrong. If you are dual-booting, at least one of the partitions must have a file system the other can read and write, or data sharing will be a big headache.
Linux Partitioning
Because Linux was designed from the start to be a multi-user OS, multiple partitions have a long history with Linux. This is partly due to how Linux, and all *nix’s, handle partitions, and partly for security reasons.
Windows must assign a drive letter to every partition, and in earlier versions of Windows changing the letter automatically assigned was impossible (or nearly so). Linux has no concept of drive letters. Everything is one continuous directory, starting from root (the ‘/’ symbol – same as the ‘\’ in “C:\” in Windows). Root is always a partition assigned by the boot loader, and which partition used is configurable.
All other partitions are attached as directories somewhere under root, and the attachment point may be several directories deep. This is configurable by the system administrator (also called “root”; yes, it can be confusing) and one partition can be a subdirectory of another partition. Some of the more common partitions that may be found on a Linux system are:

  • The root partition: This is the only mandatory partition. It defines the entire directory structure of the OS.
  • The home partition: This is where the users' data are stored. Each user usually has his/her own directory in the partition. It is separate from the OS to make upgrades easier (see Multiple Partitions above), and to make backups simpler. It also stops one user from bringing down the entire system by filling up the whole HD if you don't use quotas. A home partition and a root partition is the simplest partitioning scheme commonly used with Linux.
  • The var partition: This is a working space for the OS, a place where variable and changing, but important, information is stored. Some applications, mostly server applications (i.e. the Apache Web Server, Samba, MySQL, etc.), also store their data here by default. Many users create this a separate partition to stop some errant process from filling up the whole hard drive and bring the system down.
  • The log partition: A far less common partition, this is where the OS and many applications log what is going on. The logging is much more detailed and helpful when troubleshooting than Windows logging. This logging area is usually a subdirectory on the var partition, but some prefer it to be a separate partition. It is possible for something to happen (and not necessarily bad) and a program starts generating a huge volume of logs. This will fill up the partition the logs are on. If it is part of the var partition, this stops other programs from working. If it is on its own partition, only the various program logs stop. The programs themselves keep running (most of the time). Having to drive across clear across town at 4:45 PM on a Friday (when you had plans) through rush hour traffic because some program started logging like mad and the log and var partition were the same and it filled up so now remote access stopped working, along with other critical programs, will convince you that a separate log partition is a good idea.
  • The boot partition: More of an historical footnote now, some old boot loaders had problems booting with some files beyond a certain sector number. This partition was therefore usually the first one created.
  • The etc partition: This is where the system level configuration files are stored. Unlike Windows, Linux has no registry. Instead, each program has its own, usually text based, configuration file. If this file gets destroyed, corrupted (very rare), or otherwise messed up, only that program stops working. Having dealt with registry corruption on numerous occasions, your author has found these files are much easier to fix than registry problems. This partition is optional and some just place the files in an etc directory on the root partition.
  • The usr partition (this is not a typo, it's pronounced “user”, but spelled u-s-r): This is where most of the non-OS programs (aka applications) reside. It is optional and some just place all the files on the root partition in a usr directory.
  • The tmp partition (not a typo either, pronounced “temp”, but spelled t-m-p): This is, as the name suggests, a storage area for various temporary files. Linux can wipe this area clean as part of the boot up process, so it truly is a temporary storage area. Sometimes part of the root partition, this is often its own partition; because, since everyone can read and write here, one user could fill up the whole hard drive and bring the system down.

Conclusion
Hopefully, you now understand what partitions are and are starting to think about how to partition your next hard drive. Of course, this isn't the full story and there is more to learn for those so inclined. RAID arrays, logical volume management (LVM), and dynamic disks are good places to start.
In the next part of this series, we will begin exploring some of the tools available to create, manipulate, and destroy partitions. Until then, take a look at the companion article, An Overview of File Systems. After all, except for a few specialized cases, every partition has to be formatted with something.

An Overview of File Systems
Robert Spotswood, a HAL-PC member, is active in the Linux SIG and a freelance computer professional. He can be reached at robert@spotswood-computer.net.