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.