Linux LVM

Good basic tutorial on linux-based LVM – http://www.howtoforge.com/linux_lvm

Create new LVM PV group:

pvcreate /dev/sda /dev/sdb ... /dev/sdz

Add a new PV to an existing PV group:

vgextend volgroup /dev/sdb1

Display info about a PV group:

pvdisplay /dev/volgroup

Destroy a PV group:

pvremove /dev/sda /dev/sdb ... /dev/sdz

Increase logical volume size by 10GB (assuming there is enough unused space in the PV group):

lvextend --size +10G /dev/volgroup/logicalvolume

Set total size (can not decrease with this command):

lvextend --size 11G  /dev/volgroup/logicalvolume

Increase or decrease an LV’s size with (assume current size is 10GB for example):

lvresize --size 9G /dev/volgroup/logicalvolume

Or:

lvresize --size -1G /dev/volgroup/logicalvolume

Make sure to resize the filesystem before/after as is appropriate with:

resize2fs /dev/volgroup/logicalvolume

If decreasing the size of the filesystem, a size must be specified, if increasing, default will be to fill all available space:

resize2fs /dev/volgroup/logicalvolume 9G

Leave a Reply

My notes for future me