1

Having some issues understanding how to revert snapshots on ubuntu 14.04 using KVM...

Until now i have been using internal snapshots, however due to space issues (space not being re-allocated after snapshots deleted) I want to move to external snapshots...

I understand (although haven't tried yet) that i can merge, pull things inbetween snapshots, however i can't seem to understand how to revert to a snapshot...

Example: base <-- snap1 <--- snap2 <--- snap3 (current)

How can I go back to snap2 if i want to discard snapshot3?

... And How can I start a new instance that is a "clone" of snap2 so that i can continue testing things on it and perhaps at a later point discard it and go back to snap3 ?

This was easily made with internal snapshots using snapshote-revert, however i can't seem to understand how it works with external snapshots... Some examples would be great. Thanks

2
  1. Stop the VM.
  2. Edit the domxml using virsh edit VMNAME and point the disk at the location of snap2
  3. Start the VM.

Don't forget to delete snap3

EDIT: branching out

In order to be able to switch back to a snapshot in a chain, without corrupting the entire chain after the current snap, you need to create a branch. Using your example, you stop the VM, take a new snap of snap2 (e.g. snap2branch1) and use it to play with snap2, without actually effecting snap2. If the changes are acceptable, you abandon snap3 (and the rest of the chain, after it), rename snap2branch1 to snap3, and keep working. If you prefer to dump the changes and return to snap3, you simply abandon the branch, and switch the VM to using snap3 again.

| improve this answer | |
  • Thanks, However doing so would only cover my first case, "going back to snap2 if i want to discard snap3" how could i achieve the rest of my question? as doing as you mentioned would change snap2 – Onitlikesonic Mar 23 '15 at 12:42
  • So you want to dump all data in snap3, but not move the VM back to using snap2? Then before step 3, take a new snap3 – dyasny Mar 23 '15 at 14:24
  • lets see if i can explain this better, there are two cases I want to cover: Case 1: Reverting to snap2 and not caring about snap3 (can be achieved through what you mentioned above although i expected a better solution to be available through virsh but apparently there is none) Case 2: Reverting to snap2, doing changes there and then reverting back to snap3. Now, for case 2 if go back to snap2 and make changes means the snap2 will change and since snap3 is an increment of snap2 that means most probably snap3 is now corrupted. What i need is to be able to go back and forth on reverts. Thanks – Onitlikesonic Mar 23 '15 at 14:31
  • Case 1: there might in fact be a solution through virsh, but it will be simple orchestration of the same solution. Case 2: it's not going back/forth on reverts, it's basically branching out. I'll add the solution in the answer – dyasny Mar 24 '15 at 1:40
  • Thanks, although i was looking also for examples (commands) i will accept your answer as it pointed me in the right direction. – Onitlikesonic Mar 26 '15 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.