A merge undoes everything that happened after the snapshot. Sometimes that is too much.
After the snapshot, needed data may have appeared on the volume: new orders, users' edits. A merge undoes them too: LVM does not know which changes were mistakes, it returns blocks. So before merging, decide whether everything written after the snapshot can be lost.
The snapshot was taken at 9:00, an update broke settings.conf at 9:30, and by 10:00 the service had written new orders. What will merging the snapshot into the volume give?
-
A merge works with blocks, not files: every block changed after 9:00 returns to the snapshot, the orders' blocks included.
-
A merge returns the volume to the moment the snapshot was taken, 9:00. LVM knows nothing about the update.
-
Merging a mounted volume is postponed until its next activation, not cancelled: afterwards the volume still returns to 9:00.
A merge returns the whole volume to the snapshot moment, so both the bad edit and everything written later are gone. To keep new data, you restore only the broken files from the snapshot.
If it cannot, take only the broken part from the snapshot. Mount the snapshot separately, read-only, and copy the files you need onto the origin, just as you read settings.conf through /mnt/lvm-before at the start of the lesson. The -o ro option guards the snapshot against accidental writes: without it the snapshot is mounted read-write and starts using its own space. The snapshot stays in place and will help if something else needs restoring.
Restore one file from the snapshot
After the checkpoint snapshot an update broke settings.conf in /mnt/lvm-data, and the service wrote a new order, orders/0916.csv. Return settings.conf to its snapshot state and keep the order. Leave the snapshot: it is still needed. The /mnt/lvm-before directory is free.
Goals · 0 of 1
- Restore settings.conf from the snapshot, keeping the order not done yet