[linux-lvm] how to copy a snapshot, or restore snapshot without deleting it
zkabelac at redhat.com
Fri Jan 18 09:34:55 UTC 2019
Dne 18. 01. 19 v 1:53 Davis, Matthew napsal(a):
> Hi Zdenek,
> I assumed that LVM thin snapshots would work like git branches.
> Since git also uses diffs on the backend, and git is popular with developers, the same kind of behaviour seems reasonable to me.
> git checkout master
> git branch branchA # equivalent to creating snapshotA
> echo "modify" > file.txt # modify origin
> git checkout branchA ; git branch branchB # copy snapshotA to snapshotB
> git checkout master ; git merge branchA # restore snapshotA
> git branch # snapshotB still exists
> echo "modify2" > file.txt # modify origin
> git checkout branchB # restoring snapshot to root
> Oh well. It doesn't matter too much, since I've figured out how to get it to work. I just need to restore the oldest snapshot each time. Then LVM updates the origin accordingly.
As already said lvm2 is NOT DB engine, but let's look on it this way:
OriginLV -> snap1
OriginLV -> snap2
OriginLV -> snap3
OriginLV -> snap4
- then you decide to merge snap2 into OriginLV
So now there is *THE* question - whether snap2 can be now seen as origin for
'snap1', 'snap3', 'snap4' ?
The user might have used and update all volumes meanwhile in some way.
After long discussion - we concluded it's hard question and we decided to drop
the connection for now.
There is some possibility to analyze what is the relation between all the
orphans snaps - but it's quite a lot of work - and not directly related to
And I also want to point out you cannot really compare this with 'git' - as
with git all your steps are mostly easily reversible as all branches are still
there till prune point, while with this thin merging - one bad merge may
present quite significant data lose. Also think about the difference in
behavior between thin snaps and old thick snaps, where the merging worked
differently and way way way more slower...
IMHO the correct name of such operation is replace/swap with thins.
More information about the linux-lvm