Skip to content

LVM

LVM

Usage

Display the physical volumes and the logical volumes they conatain

pvdisplay -m

serverfault

Create new physical volume

The device must have an empty partition table or if it's a partition, it should have the 0x8e identifier (for LVM). You can achieve this things with fdisk. Once ready:

pvcreate [device]

centos

Move physical extents between physical volumes

This is useful if you want an already existing LV to be on a specific PV.

pvmove /dev/sda1:1000-1999 /dev/sdb1:0-999

superuser

Create a logical volume

lvcreate -n [lv name] -L [size in gigabytes]g [vg name]

Then format it and mount it if requiered.

debian wiki

Extend LV and filesystem

To extend the logical volume and the filesystem in it use:

lvresize --resizefs --size +931GB /dev/vg/lv_home

When extending, the filesystem can be mounted, but not when shrinking.

Reference