Physical Volumes
Usage
pvcreate Create a pv from disk pvcreate /dev/sda3
pvremove Remove a pv from a disk pvremove /dev/sda3
Move a pv to free extents (on
different pv) in the same vg pvmove -v /dev/sda3
pvmove
pvdisplay/pvs
Display info about pvs
pvscan Scan for pvs
pvresize Resize pvs to either a set size or
the size of the disk/partition
pvresize --setphysicalvolumesize 40G /dev/sda3
pvresize /dev/sda3
Volume Groups
Usage
vgcreate Create a vg from pvs. Characters
sets [] can be used for ranges vgcreate vgname /dev/sda3 /dev/sdb3
vgcreate vgname /dev/sd[d-m]1
vgremove Remove a vg vgremove vgname
vgdisplay/vgs
vgscan
Get info about vgs
Scan for vgs
vgextend Add a pv to a vg vgextend vgname /dev/sdb2
vgreduce Remove a pv from vg
Remove a missing pv from vg vgreduce vgname /dev/sdb2
vgreduce --removemissing
vgchange Change vg attributes like UUID or vgchange -u vgname
whether lvs in the vg are
vgchange -ay
accessible
vgchange -an
Logical Volumes
Usage
lvcreate Create an lv
Create an lv with stripe
Create an lv with mirror(s)
Create largest LV possible lvcreate --name lvname --size 50G vgname
lvcreate --name lvname -i3 -I4 --size 100G vgname
lvcreate --name lvname -m1 --size 50G vgname
lvcreate --name lvname -l +100%FREE vgname
lvremove Remove an lv lvremove /dev/vgname/lvname
lvdisplay/lvs
Display info about lvs
lvscan Scan for lvs
lvresize Resize an lv to a set size or a
percent of available space
lvresize --size 40G /dev/vgname/lvname
lvresize -l +100%FREE /dev/vgname/lvname
Misc
Path to Logical Volume
/dev/vgname/lvname
/dev/mapper/vgname-lvname
Logical Volumes Usage
Create a RAID0 LV lvcreate --name lvname --stripes 3 --stripesize 4 --size 100G
vgname
Create a RAID5 LV lvcreate --type raid5 --stripes 3 --size 1G --name lvname vgname
Create a RAID10 LV lvcreate --type raid10 --stripes 2 --mirrors 1 --size 10G --name
lvname vgname
Create an LV with mirror(s) lvcreate --name lvname --mirrors 1 --size 50G vgname
Split LV from mirror lvconvert --splitmirrors 2 --name copy /dev/vgname/lvname
Add tag to LV lvchange --addtag grouptag /dev/vgname/lvname
Volume Groups Usage
Splitting a Volume Group vgsplit vgname newvg /dev/sdb1
Combining Volume Groups vgmerge -v newvg oldvg
Move Volume Group to new host
vgchange -an vgname
vgexport vgname
Snapshots Usage
Create snapshot lvcreate --size 100G --snapshot --name snap /dev/vgname/lvname
Create thin-provisioned snapshot of lvcreate --shapshot --name thinsnap /dev/vgname/thinlvname
thin provisioned volume
Merge snapshot lvconvert --merge /dev/vgname/snap
Marge all snapshots with tag lvconvert --merge @grouptag
Cache Volumes Usage
Create cache data volume lvcreate -L 2G -n lv_cache VG /dev/sdf1
Create cache metadata volume lvcreate -L 12M -n lv_cache_meta VG /dev/sdf1
Create cache pool lvconvert --type cache-pool --cachemode writethrough
--poolmetadata VG/lv_cache_meta VG/lv_cache
Create cache logical volume lvconvert --type cache --cachepool VG/lv_cache VG/lv
Create thinpool on cached volume lvconvert --thinpool vg/cvol