Translation(s): English - Français

(!) ?Discussion

LVM is a Logical Volume Manager for the Linux operating system.


Logical volume management provides a higher-level view of the disk storage on a computer system than the traditional view of disks and partitions. This gives the system administrator much more flexibility in allocating storage to applications and users.

Storage volumes created under the control of the logical volume manager can be resized and moved around almost at will.


An example:

||  /boot  ||   LV-1 (/)  | LV-2 (swap)|  LV 3 (/home) | LV-4 (/tmp)|| Logical Volumes(LV)
||         ||------------------------------------------|------------||
||         ||                  VG 1                    |    VG 2    || Volume Groups(VG)
||         ||------------------------------------------|------------||
||/dev/sda1|| /dev/sda2 |     /dev/sda3    | /dev/sdb2 | /dev/sdd4  || Physical Volumes(PV)

Good to know


Logical volumes should use label to be identified in /etc/fstab, instead of the UUIDs or the kernel namming rules (/dev/sda) in order to avoid conflict with the restore of volumes snapshots.


Grub and Lilo are not compatible with LVM, so /boot should be outside the storage disk managed by LVM.

LVM2 snapshots and udev on Debian

There are some caveats while creating lvm snapshots on debian with udev, see 343671


All tools to manage an LVM volume are available in lvm2 package

apt-get install lvm2

Then start the lvm service:

/etc/init.d/lvm start

If needed, you can install system-config-lvm, it's an utility for graphically configuring Logical Volumes.

apt-get install system-config-lvm

List of LVM commands

Physical Volumes (PV)

Create a PV

To declare the /dev/sda2 as physical volume available for LVM:

pvcreate /dev/sda2

Remove a PV

In order to remove the physical volume on /dev/sda2 all data must be moved away from it. To do this make sure other physical volumes containing the same volume group have enough free space and then issue this command:

pvmove /dev/sda2

After the data is moved off the disk remove it from the volume group (here the one named myVirtualGroup1:

vgreduce myVirtualGroup1 /dev/sda2

And after these preparations finally:

pvremove /dev/sda2

PV commands list

Volume Groups (VG)

Create un group of physical volume

vgcreate myVirtualGroup1 /dev/sda2

Extend a volume group

Declare an other physical volume:

pvcreate /dev/sda3

Then add the new PV to the VG that already exist:

vgextend myVirtualGroup1 /dev/sda3

Verify VG configuration

Simply run this command:


VG commands list

Logical Volumes (LV)

Create an LV

<!> Don"t forget to check if you have enought space: an LV of 100Go don't fit in a 10Go VG.

Create a logical volume in a volume group:

lvcreate -n myLogicalVolume1 -L 10g myVirtualGroup1

Format logical volume in the filesystem you want (ext4,xfs...)

mkfs -t ext4 /dev/myVirtualGroup1/myLogicalVolume1

You can test if it's working:

mkdir /test
mount /dev/myVirtualGroup1/myLogicalVolume1 /test
df -h

You also can check your logical volumes with:


Remove a LV

To remove a logical volume make sure it is not in use anymore. Then simply issue this command to remove the logical volume myLogicalVolume1 in volume group myVirtualGroup1:

lvremove myVirtualGroup1/myLogicalVolume1

You might get asked if you really want to remove an active logical volume. If so, confirm that.

LV commands

See also: