Let’s consider a hard disk as an area where you can store information. You can divide this area into smaller sections, or if you have more than one area, you can combine them to your liking. This is where the concepts of partitioning and logical volumes come into play.
Partitioning is dividing a single area into smaller areas. Following our analogy of a hard disk as area, it is dividing the hard disk into smaller data areas. These data areas are called partitions. Once the hard disk is divided, data could easily be moved between partitions. Why would one want to partition his hard disk?
- He wants the operating system and the user data separate from each other. This way, if the operating system fails, he can set the new system onto the partition and recover all the data from other partitions.
- He wants to have a separate area for the operating system’s page file or swap space for better performance.
- He wants to use more than one operating system.
- He wants to isolate (or protect) files. For example he can place files on a separate partition and lock it with encryption.
- He wants to take advantage of smaller file tables and thereby increase the operating system’s performance. This is for NTFS drives mainly. Instead of having one master file table for a 500 Gigabyte disk, you can divide it into 100 Gigabyte partitions, thereby having one file table, a smaller one, for each partition, increasing hard disk performance.
Partitioning is usually done while installing the operating system. Of course you can play with the partitions later on, but this always carries a a risk of partition/data corruption and is considered too risky by most people.
Logical volumes follow a similar concept, but going in the other direction. Assume that you have three hard disks: one of them 10 Gigabytes the other two are 20 Gigabytes each. This gives a total storage space of 50 Gigabytes. Now, further assume that you want to allocate 15 Gigabytes for the operating system, 30 Gigabytes for user data and 5 Gigabytes for swap space (or page file). You can make an arrangement as follows:
- Partition the 20 Gigabyte drive with 15 Gigabytes space for operating system and 5 Gigabytes for swap/pagefile
- The other 20 Gigabyte disk and 10 Gigabyte disk drives remain separate, and can be used for user data.
But what if your hard disk sizes and your preferred sizes do not match? Say you did not have a 20 Gigabyte disk to partition as 15 + 5 Gigabytes, or you required more space for the operating system, say 25 Gigabytes? Maybe the user wants all 35 gigs to show up and act as one drive, not two smaller ones? Let’s assume this last case and continue our example.
This is where logical volumes comes into play. You can arrange your disks in a configuration to allow for 15 Gigabytes of operating system usage, 5 Gigabytes for swap/page file usage and the 35 Gigabytes of user data without worrying about having to place it on the same disk. You set the sizes and the logical volume manager (almost all of the partitioning programs allow you to set up logical volumes) will take care of the rest.
As you see in the image, the disk sizes are irrelevant with the logical volume setup. You can take say, 5 Gigabytes from first disk, 10 Gigabytes from the second and 15 Gigabytes from the third. In addition, you can use partitions with the logical volumes, which gives you greater flexibility to balance performance, convenience, and reliability.
You can change the logical volume sizes when the system is running. As long as you have the necessary disk space you can extend or shrink the logical volume sizes with a couple of clicks, or in Linux/UNIX systems just with a one line command. Playing with logical volume sizes is much safer than playing with partition sizes.
To manage your storage both effectively and efficiently, you need to have a good working knowledge of partitions and logical volumes and use them as puzzle pieces or Lego blocks to suit your needs. Once you have set up a system, managing the logical volumes becomes a common task for a system administrator. As an example, in the case of a server supporting hot swaps, you can just insert an empty hard disk and extend your user data partition without interrupting anyone’s work.