I was reading Jason Boche’s blog on snapshots yesterday and noticed a misunderstanding. I tweeted Jason about this and his blog was updated in a sec. But I thought it might be handy to actually outline the basics again especially because during the VMTN Experts Podcast there was a huge discussion on snapshots. Unfortunately I could not join the call via audio so I decided to respond here.
While I was just checking my Google Reader I noticed that Eric Siebert beat me, he just released this blog that explains the basics of snapshots.
When a snapshot is created, the original disk becomes read-only, and a separate delta file is created that contains all the disk changes that are made thereafter. The delta file does not contain an ongoing history or transaction log of all the changes to data on the disk, it simply updates disk blocks as they are changed. If a particular block is changed it is written to the delta file, but if that same block is changed again later on the existing block is simply updated with the new data and a new block is not written to the delta file.
I want to add the following, which is an outtake of one of my articles from a couple of months ago:
Snapshot 1 – 20GB
Snapshot 2 – 10GB
Snapshot 3 – 30GB
When you choose “delete all” the following will happen:
- A helper snapshot is created which holds all changes
- Snapshot 2 will grow to 40GB at most
- Snapshot 1 will grow to 60GB at most
- Snapshot 1 will be committed to the original VMDK
- The helper is committed to the original
- All snapshot files are deleted
In other words: Snapshot 3 is merged into Snapshot 2, Snapshot 2 is merged into Snapshot 1, Snapshot 1 is merged into the original flat.vmdk and afterwards all snapshot files are deleted. This means that if you want to delete all snapshots at once you will need around 70GB of free disk-space in this particular situation and the size of the helper snapshot. So think twice before you press the “delete all” button.
So it comes down to the following:
- a single snapshot will not grow larger than it’ parent disk
- the disk files are not deleted until everything is consolidated
- a snapshot will grow in 16MB chunks and every time it grows the VMFS volume will be locked
Gabe was so kind to visualize the Snapshot “delete-all” process:
Thanks Eric for stealing my article 🙂
And for those who have got access to the VMworld presentations, check out TA14 – VMworld 2008 Europe.