Understanding Logical Volume Manager (LVM) was a painful task for me. It took me quite a long and several failed configurations to set it up correctly. To help others and myself actually (So that I nail it down) I am writing this post on the Concepts of Logical Volume Manager (LVM).
There are some core terms or concepts that will make your Logical Volume Manager (LVM) life easier.
- Physical Volume
- Logical Volume
- Logical Group
- Physical Extents
The logical volume manager can be best explained with the help of a diagram. Assume we have two separate hard drives one 10 GB and another one 6 GB.
Now we can call the 10 GB and 6 GB hard drives as the physical volumes (Because actually they are physically present).
Now the physical volumes are made up of physical extents. The physical extents are small chunks on the physical volumes, the default size being 4 MB. The physical volume with 10 GB will contain 25000 chunks (Sorry for poor MATH) similarly 6GB physical volume will contain 15000 chunks.
Now we can combine them i.e. 10GB and 6GB physical volumes to form a 16GB logical group. (Yes it will be a logical group as it is formed of two different physical volumes).
Now the real part LOGICAL VOLUMES in the LOGICAL VOLUME MANAGER (LVM). This can be best explained with the help of an example consider we need to mount a 12GB share and allocate 4GB space to another user directory.
With the help of traditional partitioning this wouldn’t have been possible as maximum size we have for our hard drive is 10GB and we need is 12 GB. To solve this problem we create LOGICAL VOLUMES. The logical volumes you can say are like partitions in the LOGICAL GROUP. So we will create two LOGICAL VOLUMES in the LOGICAL GROUP.
The advantage of logical volumes is that it can be used for anything. The logical volumes can be formatted to any filesystem format supported by your LINUX DIST. Another advantage of LVM being that we can shrink or expand the size of LOGICAL VOLUMES like in our case if we need 20 GB for the share we can just add another physical volume to the group and assign space from or if the space is available in the Logical group we can straight forwardly assign the space to the logical volume. The only exception is that you cannot mount /BOOT partition to a logical volume. That’s a downside for the Logical Volume Manager (LVM).
I will be explaining HOW TO SETUP LOGICAL VOLUME MANAGER (LVM) in my next post. If I have missed something or you have some questions do post the comments.