VMware Communities
mdelvecchio
Contributor
Contributor

deleting snapshot - why does it take so long?

hello,

i needed to up the size of my VM's hard drive but Fusion 4 said i needed to delete all the snapshots first (sounds reasonable). however doing so took hours...the act of deleting a single snapshot was anywhere from 15-30 minutes of progress-bar. Mac nini from 2010, 8gb ram.

what's this about? what is it doing?

thanks,

matt

Reply
0 Kudos
13 Replies
admin
Immortal
Immortal

When you take a snapshot, it creates 3 files inside the VM bundle:

  • .vmsn
  • .vmem
  • .vmdk

Out of these the .vmdk is the virtual disk which contains the data. Hence, it will be huge in size (depending on the changes that you did after that snapshot was taken). When deleting a snapshot, it will delete all these 3 files related to that particular snapshot. .vmem and .vmsn gets deleted faster, but deleting .vmdk will take time because of its size. This is the reason.

Wait, for the cleaning up process to complete after deletion of each snapshot. Interrupting it, might corrupt the snapshot chain and the VM will not start.

phildaant
Contributor
Contributor

I noticed that too. Annoying. Smiley Sad

Reply
0 Kudos
admin
Immortal
Immortal

The actual deletion of the snapshot is very quick, the .vmem and .vmsn files are deleted.  The disk clean up after deletion is what is taking the time.  The VM needs to go through the .vmdk files associated with the deleted snapshot(s) and determine if data in them is being used by either the current state or other snapshots before it can delete them.

koi
Enthusiast
Enthusiast

As long as you're not deleteing the last snapshot in a branch, when you delete a snapshot, you're not throwing away your current data, you're throwing away the ability to go back in time to the snapshot. All your data is still there. Simply throwing away data (the first case) is fast, but merging files together (the second case) depends on how much data there is.

Reply
0 Kudos
a_p_
Leadership
Leadership

Just want to add a link about snapshots. Although for ESXi, KB http://kb.vmware.com/kb/1015180 explains how snasphots work.

André

Reply
0 Kudos
WoodyZ
Immortal
Immortal

pramodj wrote:

When you take a snapshot, it creates 3 files inside the VM bundle:

  • .vmsn
  • .vmem
  • .vmdk

That is not totally true!  A Snapshot related .vmen file is not created when taking a Cold Snapshot and is only created when taking a Hot Snapshot.

Reply
0 Kudos
admin
Immortal
Immortal

Agreed. I was talking about a Hot snapshot.

Reply
0 Kudos
WoodyZ
Immortal
Immortal

I rarely ever take hot snapshots and almost always only take cold snapshots.   I find because of the number of VM's I have and Snapshots I take, I can't waste the space having copies of what was in RAM.  The time to shutdown, take the snapshot and restart is negligible compared to wasted disk space and longer backups, etc. Smiley Happy

Reply
0 Kudos
admin
Immortal
Immortal

Same here. Why waste 4 GB or 8 GB of disk space simply for .vmem files. Smiley Happy

Reply
0 Kudos
mdelvecchio
Contributor
Contributor

bspath wrote:

The actual deletion of the snapshot is very quick, the .vmem and .vmsn files are deleted.  The disk clean up after deletion is what is taking the time.  The VM needs to go through the .vmdk files associated with the deleted snapshot(s) and determine if data in them is being used by either the current state or other snapshots before it can delete them.

ah...disk clean up. ok. i wasnt sure why simply deleting a big file took so long, but that makes more sense.

thanks. i hit "helpful answer" but i want to set yours to "correct" answer if possible...

Reply
0 Kudos
WoodyZ
Immortal
Immortal

thanks. i hit "helpful answer" but i want to set yours to "correct" answer if possible...

Well once set it can't be changed however bspath's answer it totally correct to begin with as the .vmdk is part of the Snapshot!

Reply
0 Kudos
mdelvecchio
Contributor
Contributor

WoodyZ wrote:


Well once set it can't be changed however bspath's answer it totally correct to begin with as the .vmdk is part of the Snapshot!

actually what i consider correct about bspath's answer has to do w/ my question on time -- "why" does a file delete take so long: scanning the .vmdks to determine if their data is affected...

Reply
0 Kudos
a_p_
Leadership
Leadership

That's actually not really what's done when deleting a snapshot. All data of the snapshot's .vmdk file is being merged into it's direct parent when you delete a snapshot, so the time needed is directly related to the size of the snapshot. Please - unless you already did - take a look at the KB article I posted. The picture at the end of the article may help understanding this better.

André

Reply
0 Kudos