
Below you find a solution if you want to make a LVM Snapshot before you install the latest Updates.
Table of contents
1. Environment
2. Create a Snapshot before you install the latest Update
3. If the Updates don’t break your system
4. If the Updates break you system
1. Environment
Partition table
sudo fdisk -l /dev/sda
Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: QEMU HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3a11f056
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1230847 1228800 600M 83 Linux
/dev/sda2 1230848 83886079 82655232 39.4G 8e Linux LVM
LVM
sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_root lvm2 a-- 39.41g 0
sudo vgs
VG #PV #LV #SN Attr VSize VFree
vg_root 1 2 0 wz--n- 39.41g 10.00g
sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg_root -wi-ao---- 25.41g
lv_swap vg_root -wi-ao---- 4.00g
2. Create a Snapshot before you install the latest Update
sudo lvcreate --extents 100%FREE --snapshot --name lv_root_snap /dev/mapper/vg_root-lv_root
Logical volume "lv_root_snap" created.
sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg_root owi-aos--- 25.41g
lv_root_snap vg_root swi-a-s--- 10.00g lv_root 0.01
lv_swap vg_root -wi-ao---- 4.00g
Now you can update your system
3. If the Updates don't break your system
You can remove the Snaphost with the following command
sudo lvremove vg_root/lv_root_snap
4. If the Updates break you system
Use the commands below if the Updates break your system. It’s possible to run this command when your system boots normally or from a Live System.
sudo lvconvert --merge vg_root/lv_root_snap
sudo reboot
sudo lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root vg_root Owi-aos--- 25.41g 1.42
lv_swap vg_root -wi-ao---- 4.00g
Now the Snapshot merge with the main lv in the background. If it is down to 0% you can reboot your system.