Linux - LVM
Globals
Install LVM:
Config file:
Archive path which contain all previous lvm map:
/etc/lvm/archive
# Ex of file: vg_data_00002-1038365342.vg
Commands
Logical Volume (LV)
LV detail:
lvdisplay -v {lv-path}
# Ex: lvdisplay -v /dev/Debian/lv_dynatrace
Display all lv:
Extend FS:
lvextend -L +{size} {lv-path} -r
# Ex: lvextend -L +2G /dev/vg_data/lv_data -r
Create LV with max size available:
lvcreate -l 100%FREE -n {lv} {vg}
# Ex: lvcreate -l 100%FREE -n lv_tempdb vg_data
List LV by devices:
Delete PV:
pvremove {pv-path}
# Ex: pvremove /dev/sdc
Volume Group (VG)
Disable VG:
Enable VG:
List all LVs of a VG:
Create VG:
vgcreate {vg} {pv-path} (-s {block-size})
# Ex: vgcreate vg_data /dev/sdb -s 128M
Remove PV of a VG:
vgreduce {vg} {pv-path}
# Ex: vgreduce vg_data /dev/sdc
Troubleshooting
Force refresh of metadata:
systemctl restart lvm2-lvmetad.service