Logical Volume Manager Cheatsheet

Today I got a new harddisk, so it was finally time for me to have an in depth look at LVM. I use it to combine two harddisks /dev/sdg1 and /dev/sdb1 into one volume group ext_vg which contains one big logical volume /dev/ext_vg/ext. In short, my 250GB and 500GB harddisks are used in one big 750GB ext3 mount point.

I followed the excellent LVM Tutorial, and was surprised how easy everything goes. Here is a short cheat sheet of the important commands (take care to exchange the partition/volume names if you use this):


I use Ubuntu, so this is a piece of cake:

There is also a GUI available, but I found the command line tools are very easy to use so there is no real need. I wouldn’t use EVMS as it is not supported in Ubuntu 7.10 and may cause problems.

Create a New Filesystem

First I create the physical volume on the partition sdg1, create a new volume group ext_vg that contains this physical volume, and create a new logical volume of size 450GB within the volume group. Finally create the filesystem (disabled reservation space, see Get More Space Out of Your ext3 Partition).

Show Status

Each LVM layer has its corresponding command to get information about the metadata:

Mount via fstab

I use the filesystem mainly for data, so allowing just rw is enough (no executables allowed). noatime allows quicker access.


It is even possible to do an online resize of the system, wohoo :-) This extends the logical volume by 200MB.

You can watch the resize process going on with df -h.

Add Another Partition to the Logical Volume

To add another partition and use up all the available space in the logical volume, first add the physical volume to the volume group, then use pvdisplay to find out the total available number of free PE (add the numbers from the physical volumes), then use lvextend to use up all this available space.

That’s it! Any questions? please post.


  1. Christian says:

    Thanks Martin, that was just what I was looking for :) I had been too lazy about it to bother to figure it out :shame: But now I can safely say goodbye to runlevel 5

  2. Christian says:


    one usefull addition could be to mention certain switches when creating LV:
    lvcreate -l 100%VG -n mynew_lv mynew_vg

    The -l switch has some meta options for adding 100% of the Volume Group (VG), or 100%FREE to allocate all of the free space.

    Otherwise you have to figure out how many extends a volume has or how much left, etc. These meta option are much easier to remember (at least for me)

    thanks again!

  3. Heston Holtmann says:

    Nice summary… but how would you move a Logical Volume from one VG to a completely different VG?

    I thought it would be possible with the pvmove command but it appears to only work for moving Physical Extents of a LV from one VG device to another.

Leave a Reply

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