Table of Contents

,

Create LVM on Debian 7

apt-get install lvm2
etc/init.d/lvm start
pvcreate /dev/sda
vgcreate myVirtualGroup1 /dev/sda
vgdisplay

Create a logical volume in a volume group:

lvcreate -n myLogicalVolume1 -L 10g myVirtualGroup1
lvdisplay

Format the logical volume to the filesystem you want (ext4,xfs…):

mkfs -t ext4 /dev/myVirtualGroup1/myLogicalVolume1''

You can test to see if it's working:

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

Expand entire logical volume to whole disk (/dev/sdX):

pvcreate /dev/sdX
vgextend myVirtualGroup1 /dev/sdX
lvextend -l +100%FREE /dev/myVirtualGroup1/myLogicalVolume1
resize2fs /dev/myVirtualGroup1/myLogicalVolume1

Tested on

See also

References