July 9, 2020

Understanding The Concept Of Logical Volume Manager – LVM

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.

Akash Deep Singh

|| Eat Packets || Drink Management || Sleep Virtual || Work Linux || Think I.T. || Love MAC || Look After Windows || Dream APPS ||

View all posts by Akash Deep Singh →

24 thoughts on “Understanding The Concept Of Logical Volume Manager – LVM

  1. How to extend a logical volume by using a new hard disk..if the logical volume of first hard disk remains full…

    1. Hi Prashant,

      Nice to see your Comment, I am working on a video and post to demonstrate LVM. The problem with the mic caused the delay. But in the mean time if you would like to
      try it you can do the following steps.

      1.) Add the new hard drive.
      2.) format it using the fdisk command.
      3.) Issue the command partprobe ( So that system gets aware about the new partition).
      4.) Create new physical volume using command pvcreate.
      5.) Now extend the volume group using vgextend .
      6.) Now extend the logical volume using command lvextend.
      7.) The final step resize the filesystem using the command resize2fs.

      There you go. Seems difficult and complicated I will try to finish the post by tomorrow

  2. Thanks for the post.
    Please let me know where i can get videos to understand the concepts of LVM.

    Also please clear one point:
    i am trying to install ubuntu12.10 on my existing fedora 9 which currently exists besides windows(dual boot). i am doing via unetbootin. NOw, i reboot and select unetbootin and then install ubuntu. Then it asks for language (english). Then in instllation type, what i a trying to do is: there are 2 partitions of fedora , one swap and other LVM. i want to delete both and install ubuntu. but i am not able to delete the partition of LVM. Also, on the top of the window, for this partition the type is shown as unknown. How to delete so that i can install my ubuntu on this space.
    Waiting eagerly for your reply

  3. thank you for this post,
    i have a doubt, you say The only exception is that you cannot mount /BOOT partition to a logical volume. i don’t clear the line please enplane the line why it cannot mount/boot partition to a logical volume?

  4. @Rajesh

    /boot cannot reside in LVM when using GRUB Legacy, which does not support LVM. In simple words I think the /boot partiotion contains the system kernel and initial RAM disk images. Actually LVM will start after the kernel loaded with all the parameters for LVM. If we create /boot in LVM then GRUB cannot find the root partitions. (if any mistake correct me.)

  5. Nice article .

    If /boot cannot be created in a LVM , it means that we need to allocate a separate physical HDD for the same .

    As per your above example ,of 10 gb and 6 gb physical discs , do we need to format another hdd for /boot partition.


  6. Excuse for the delay , i meant suppose we are doing a installation on a bare metal server ,which has two 500 gb SCSI disks . So initially i have to create a partition for /boot say 500 mb and then create partitions for LVM .

    Another query ,When we do the first installation , we get the option of disk druid ,where we allocate partitions graphically .Kindly let me know , do we need to use LVM command line configuration ,only after we install Linux completely.

  7. What is the meaning of host#(host0,host1….) directory while scanning LUN on linux operating system? (/sys/class/scsi_host/host#/scan)

  8. It was nice understanable theory..But i have confusion over physical extents. Can you please explain what is physical extents.

Leave a Reply

Your email address will not be published. Required fields are marked *