Managing LVM Snapshots on Arch Linux

From Wiki
Jump to navigation Jump to search


In this video, the viewer is shown how to manage snapshots on an Arch Linux system, installed with LVM.

Relevant Links
Original Video

LVM Commands

Process to resize a volume

See current partition sizes
 df -h
Verify that there is enough space
Extend the logical volume (adjust your logical volume name if different)
 lvextend -L +20g -n /dev/mapper/volgroup0-lv_home
Resize the filesystem after enlarging it
 resize2fs /dev/mapper/volgroup0-lv_home
Check the partition size again
 df -h

Creating a snapshot

Verify how much space you have left
Create the snapshot
 lvcreate -L 5GB -s -n root_snapshot_20190526 /dev/mapper/volgroup0-lv_root
List current snapshots
Restoring a snapshot
Snapshot restore command
 lvconvert --merge /dev/volgroup0/root_snapshot_20190526
Reboot the machine to finalize the changes
Notice that the test file is gone
 ls /home/<user>

Making a Snapshot Final

To make a snapshot final, remove it
 lveremove /dev/volgroup0/root_snapshot_20190526