Joined: 07 Mar 2005
|Posted: Fri Sep 02, 2016 6:08 am Post subject: on merging lvm snapshots
I'm a long time LVM user and I'm very happy with it, in my experience it is rock-solid.
But I rarely used the snapshot merging (lvconvert --merge) and I would like some opinions about it's reliability, and it would be great to hear some words from someone who knows how LVM internals work.
I'm working on an update procedure that needs to be done in transactional fashion:
1. I have a read-only filesystem (it is a root filesystem, but I think this isn't so important), to be updated.
2. start a snapshot, mount it (writable), update the content
3. unmount the snapshot.
4. merge the snapshot logical volume onto its original lv; BUT the original lv is mounted, so the merging will be postponed when the original lv isn't mounted; in my case, this happens at the next boot (and this is exactly what I want, and the merging runs while the system is booting - awesome).
This works flawlessly so far. I'm happy.
My question is about the reliability of the merging request at point 4. LVM cannot start the merge operation immediately, so it keeps track that it needs to be done, and the command exits almost immediately. Can I be sure that, in case of power loss while this lvconvert command is running, the LVM metadata will be consistent, so the next boot I will have either my non-updated filesystem or my completely updated one?
Another (more tricky) question: the lvconvert --merge lets me to merge more than one snapshot in one single command. Can I be sure that all or none of my snapshots will be merged at the next boot, in case of power loss?
Thanks in advance for any hint.