Acho que você está procurando por lvconvert --merge
. Na página do manual:
--merge
Merges a snapshot into its origin volume. To check if your kernel supports this feature, look for
snapshot-merge
in the output ofdmsetup targets
. If both the origin and snapshot volume are not open the merge will start immediately. Otherwise, the merge will start the first time either the origin or snapshot are activated and both are closed. Merging a snapshot into an origin that cannot be closed, for example a root filesystem, is deferred until the next time the origin volume is activated. When merging starts, the resulting logical volume will have the origin's name, minor number and UUID.
While the merge is in progress, reads or writes to the origin appear as they were directed to the snapshot being merged. When the merge finishes, the merged snapshot is removed. Multiple snapshots may be specified on the commandline or a @tag may be used to specify multiple snapshots be merged to their respective origin.
Suponha que você tenha um volume lógico vg0 / system que contenha seu / filesystem.
# create a read-only snapshot
lvcreate -pr --snapshot --name system_snapshot vg0/system
# upgrade or something
# if it fails, reboot and do this from a livecd
lvconvert --merge vg0/system_snapshot
# reboot again and you have your old system back
As reinicializações são necessárias apenas porque neste cenário você não pode desmontar o sistema de arquivos. Se não for o / fs, a desmontagem é suficiente.
Lembre-se de que o instantâneo será excluído após a mesclagem.