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 ||

23 Comments

  1. prashant   •  

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

    • Akash Deep Singh   •     Author

      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. Pingback: How To Setup Logical Volume Manager (LVM) Step By Step | RouteMyBrain

  3. balu   •  

    akash…..great job :)

    From this post,I could learn wht is lvm……

  4. ravi   •  

    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

  5. rajesh   •  

    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?

  6. Vishnu Prasad   •  

    @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.)

  7. riswan   •  

    Great above mention diagram easyly observer what is ohm thank you boss by riswan from rmd

  8. vijay   •  

    nice post it,s very important for any Linux
    beginners

  9. suds   •  

    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.

    thanks

    • Akash Deep Singh   •     Author

      Sorry,

      I am not clear on what you exactly mean.

  10. suds   •  

    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.

  11. Sunil   •  

    Thank you so much Akash for explaining the concept of LVM in such simple words ! :)

  12. Harry   •  

    Amazing explanation. Very simple. Amazingly effective.

    Awsome…..

    Keep up the work…..

  13. Yatendra Vashishtha   •  

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

  14. thamizh   •  

    kindly share me the video

  15. Raj Batra   •  

    Thanks for nice post.
    but seems the concept of volume group is missing.

  16. Tusher   •  

    Definitely it was excellent, before i could not understand LVM. Now it easy for me for this.
    Thank to writer.

  17. Damien Snow   •  

    Nicely done, sir.

  18. Minal   •  

    Thanks! this manual is very good! 😀
    Now my concepts are clear..

  19. balamurugan   •  

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

  20. roopA   •  

    ThanQ very much for this post

Leave a Reply

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