LVM commands

This note focuses on manual creation and manipulation of LVM.

Create Physical Volume

pvcreate /dev/sdax

Create Logical Volume Group

vgcreate vgx /dev/sdax
Create Logical Volume
lvcreate -n vmxx --size 6g vgx
Create Patition of logical Volume
fdisk /dev/vgx/vmxx
Map and mount
kpartx -v -a /dev/vgx/vmxx
mount /dev/mapper/vmxxp1 /foo
Remove mapping
kpartx -v -d /dev/vgx/vmxx
#Walk through
lvcreate -n storage --size 40g vg0
fdisk /dev/vg0/storage
n - new partition
p - primary partition
1 - partition number 1
Just create new parition
kpartx -v -a /dev/vg0/storage
mkfs.ext3 /dev/mapper/storage1
mkdir /foo <---- THE DIRECOTRY TO MOUNT
mount /dev/mapper/storage1 /foo