22 Logical Volume Manager - Creation, Resize, Snapshot, Deletion
22 Logical Volume Manager - Creation, Resize, Snapshot, Deletion
LVM
It is a device mapper target in linux
Features
Snapshots
Volume group - VG
PV PV PV PV
PV
Volume Group
Multiple physical volume combined together to form a storage pool called volume group
Logical Volume
/dev/sdb
/dev/sdc
/dev/sdd
#verify
pvs
Create VG
#create vg
#verify
vgs
pvs
Create LV
#create lv
or
#verify
lvs
vgs
pvs
Give filesystem
Note:
mkfs.xfs /dev/testvg/testlv
or
mkfs.xfs /dev/mapper/testvg-testlv
Mounting
#temporary mounting
#permanent mounting
vi /etc/fstab
:wq
mount -a
Extending LV
lvextend -r -L +5G /dev/mapper/testvg-testlv
Verify:
1PE = 4MiB
#verify
pvdisplay
vgdisplay
lvdisplay
Extending volume group
vgextend testvg /dev/sdd
Note:
● Volume group can be extended by adding a hard disk or partition without file system
Reducing volume group
vgreduce testvg /dev/sdd
Note:
● Volume group can be reduced by removing a physical volume which is not in use
Removing the old or unused hard disk
umount /mnt
#remount
mount -a
Deleting the logical volume
#remove entry from /etc/fstab
#unmount
umount /mnt
lvremove /dev/testvg/testlv
vgremove testvg