VMware Communities
kenolson
Contributor
Contributor
Jump to solution

Discard snapshot without merge to parent

Using Workstation 8, how can I discard a snapshot and recover its disk space without merging to the parent disk (i.e. I want to throw the changes away). In particular there is a tree of snapshots such as the following:

baseOS

   + parentA - snap1

          +--- snap2

          +--- snap3

          + (etc)

baseOS is the snapshot after the OS install, parentA is the snapshot after a database server is instaloled with no user data in it. Each snapshot is the data from a specific build of software and is retained for a week or so for comparison purposes. When a snapshot ages sufficiently and is no longer needed, I'd like to discard it and reclaim the disk space.

So, for example, I want to discard snap1. I can't use "delete snapshot" because that would merge the data into parentA's current state and would then be visible when I create the snap4. I can't use "revert to parentA" because that would delete not only snap1 but also snap2 and snap 3.

It appears that if I delete snap1 the vm's current state is set to parentA at (etc) in the tree above. If I then "goto snap2" that state is discarded and if I then "goto parentA" the changes associated with snap1 are gone. Is there any simpler way to just discard the content of a snapshot?

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
continuum
Immortal
Immortal
Jump to solution

In this example you could delete the snapshots marked in red
SnapManagerExample.PNG

to do so you would have to inspect the vmsd-file.

Reading it you would have to find out which vmdk-file relates to which snapshot.
Example: snapshot Oracle 11G R2 Base may relate to diskname-000123.vmdk

If you are sure you never ever need to go back to the first branch in this case you could then delete diskname-000123.vmdk with your filemanager, explorer or whatever you use.

Warning: if you start to delete vmdks manually the display in snapshotmanager will become inconsistent !!!

If possible I would avoid this manual actions.

Maybe post a feature request.
there really is no way to get rid of unused branches using the GUI


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

View solution in original post

Reply
0 Kudos
10 Replies
continuum
Immortal
Immortal
Jump to solution

can you post a screenshot of snapshotmanager so that we can talk about an example ?

I think I understood what you have in mind -  I just want to make sure


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
kenolson
Contributor
Contributor
Jump to solution

I pulled together an example - when I roll this out the Oracle branch of the tree will be in a separate VM and will mirror the db2 branch that is fleshed out here. As I add additional daily snapshots, I'll want to discard the older ones.

SnapManagerExample.PNG

Reply
0 Kudos
continuum
Immortal
Immortal
Jump to solution

In this example you could delete the snapshots marked in red
SnapManagerExample.PNG

to do so you would have to inspect the vmsd-file.

Reading it you would have to find out which vmdk-file relates to which snapshot.
Example: snapshot Oracle 11G R2 Base may relate to diskname-000123.vmdk

If you are sure you never ever need to go back to the first branch in this case you could then delete diskname-000123.vmdk with your filemanager, explorer or whatever you use.

Warning: if you start to delete vmdks manually the display in snapshotmanager will become inconsistent !!!

If possible I would avoid this manual actions.

Maybe post a feature request.
there really is no way to get rid of unused branches using the GUI


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
kenolson
Contributor
Contributor
Jump to solution

Okay, thanks for the advice.

I've noticed that after deleting the .vmsn and .vmdk files corresponding to the snapshot, if I then go into the GUI and ask it to delete the snapshot it will rebuild the .vmsd file and correctly display the remaining snapshots in the Snapshot Manager GUI.

Reply
0 Kudos
continuum
Immortal
Immortal
Jump to solution

does the rebuild of the vmsd file even work for trees with several branches ?


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

kenolson wrote:

So, for example, I want to discard snap1. I can't use "delete snapshot" because that would merge the data into parentA's current state and would then be visible when I create the snap4.

No.  Snapshots are, from a user-visible perspective, immutable once taken.  When snapshots are deleted, data might be merged to child snapshots (because those child snapshots already had access to that data) but never merged to parents.

I can't use "revert to parentA" because that would delete not only snap1 but also snap2 and snap 3.

Reverting will throw away whatever your current state is, but it doesn't delete snapshots.

Think of snapshots as save states in a video game.  Reverting will throw away any changes that you haven't saved to a snapshot, but the snapshots themselves are not modified.

kenolson
Contributor
Contributor
Jump to solution

James Lin wrote:

kenolson wrote:

So, for example, I want to discard snap1. I can't use "delete snapshot" because that would merge the data into parentA's current state and would then be visible when I create the snap4.

No.  Snapshots are, from a user-visible perspective, immutable once taken.  When snapshots are deleted, data might be merged to child snapshots (because those child snapshots already had access to that data) but never merged to parents.


Agree - after I did some additional testing. At least some of my confusion comes about because deleting the currently active snapshot (2011-09-26-17:00-Mon in the image below) will have its content show through in the current "You Are Here" state (in that the content was the same in my little tests) which becomes attached directly to "DB2 Base", and if one starts the VM using that state one sees the changes. If one goes to "2011-09-25" and starts the VM one does not see the changes. And this "go to" discards the state that contained the merged changes so that if one subsequently goes to "DB2 Base" and starts the VM, one does not see the changes (even though the Snapshot Manager GUI looks similar).

So for my purposes the key thing to remember is to make sure the current state gets discarded after I delete a snapshot if there was any possibility that the deleted snapshot was the parent of the current state which will become attached to "DB2 Base".

I think I'm getting my head around this concept now.

Example4.PNG

One source of confusion is found in the article http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=100940... where it says:

If you delete a snapshot you do not affect the current state of the virtual machine or any other snapshot.

Warning: All data associated with the deleted snapshot is permanently committed to the parent disk in the chain.

But it would seem that is not strictly true in the examples I've been using in this thread - the parent disk is also unchanged. Is it the case that if the snapshot is the immediate child of the parent disk and it is deleted the contents are then merged to the parent disk? But in all other cases the parent disk and any parent snapshots remain unchanged?

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

kenolson wrote:

But it would seem that is not strictly true in the examples I've been using in this thread - the parent disk is also unchanged. Is it the case that if the snapshot is the immediate child of the parent disk and it is deleted the contents are then merged to the parent disk? But in all other cases the parent disk and any parent snapshots remain unchanged?

I think that KB article isn't quite right.  I think whoever wrote it was confused.  I'll try to get it corrected.

Deleting snapshots does not merge any content to the parent snapshots.  Like I said, snapshot are, for all practical purposes, immutable once taken.

Reply
0 Kudos
kenolson
Contributor
Contributor
Jump to solution

Yes, it appears that it does.

Reply
0 Kudos
kenolson
Contributor
Contributor
Jump to solution

Agree, snapshots are immutable. But the original parent disk is updated - at least when there is only one snapshot which is its immediate child and that snapshot is deleted. Files that I created in that snapshot were merged back into the parent vmdk when the snapshot was deleted. At that point the VM had no snapshots remaining.

So it would appear that the KB article is partly correct - at least when the final snapshot is deleted, the original disk seems to be updated.

Reply
0 Kudos