Increasing the size of an LVM volume

In a previous article we looked at LVM. This short article describes how to grow an existing volume by adding an extra disk to the system. Specifically, we use a XenServer guest VM with CentOS installed.

The first disk of a XenServer guest VM is called xvda, the second disk (the one we added) is called xvdb. We start with the creation of a Physical Volume (PV) on the extra disk.

pvcreate /dev/xvdb

Then we extend the existing Volume Group (VG) called VolGroup00.

vgextend VolGroup00 /dev/xvdb

Then we extend the Logical Volume (LV) to the total size of the current and the extra disk, e.g. 12GB, or we extend the Logical Volume (LV) by the size of the extra disk, e.g. 4GB (pick one of these two methods).

lvextend -L12G /dev/VolGroup00/LogVol00
lvextend -L+4G /dev/VolGroup00/LogVol00

Finally we resize the filesystem that uses this LV.

resize2fs /dev/VolGroup00/LogVol00

One thought on “Increasing the size of an LVM volume

  1. Permalink  ⋅ Reply

    Jørn Klungsøyr

    January 13, 2012 at 2:27pm

    Hi,
    Thanx for interesting post!
    Would you have a similar suggestion on how to increase the Logical Volume (LV) if you increase the size of the physical disk (not adding a new one). In XenCenter I’ve increase a disk from 8GB to 100GB – but when I run e.g.
    lvextend -L92G /dev/VolGroup00/logVol00
    I get a message: Innsufficient free space: 2757 extents needed, but only 0 available. I assume I must do something in addition.
    Thanx for any input.
    I’m running cento5.7 and xenserver5.6

Leave a Reply

Your email will not be published. Name and Email fields are required.