You may have noticed that if you try to delete a virtual machine with snapshots associated with it – it can take quite a long time for the virtual machine to complete deleting. The reason for this is that we are “cleaning up” the snapshot files – which may involve merging AVHD files.
Let’s imagine that you had performed to following steps:
- Created a blank virtual machine
- Installed Windows Vista
- Taken snapshot “Windows Installed”
- Installed Microsoft Office
- Taken snapshot “Office Installed”
- Written your life’s memoirs
- Taken snapshot “Finally done”
- Installed Windows Live
- Taken snapshot “Live installed”
- Applied snapshot “Finally done”
It is our belief that if you were to delete the virtual machine at this point in time – you would expect the virtual hard disk that is left over to contain Windows, Office and your memoirs – but not Windows Live. To do this we need to merge in all of the changes from the first three snapshots, which can be quite a time consuming operation. Essentially what we are doing is deleting each of the snapshots first (which can result in merging of AVHDs) and then deleting the virtual machine when that operation is finished.
The alternate options would be:
- Discard all the AVHD files. Which in this case would leave you with a VHD with just Windows installed on it.
- Leave the AVHD files where they are. Unfortunately – you may not always know where these files are, which could be quite problematic for cleaning up later.
If you have a virtual machine with snapshots that you want to delete quickly – and you do not care about the data that is stored in the virtual machine snapshots – you can do so by simply applying the first snapshot (in the above case “Windows Installed”) before deleting the virtual machine.