Thursday, October 2, 2014

VMware 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.

Deleting a snapshot removes the snapshot from the Snapshot Manager. The snapshot files are consolidated and written to the parent snapshot disk and merge with the virtual machine base disk.

When you delete the base parent snapshot, all changes merge with the base virtual machine disk.

Deleting snapshots involves large amounts of disk reads and writes, which can reduce virtual machine performance until consolidation is complete. Consolidating snapshots removes redundant disks, which improves virtual machine performance and saves storage space. The time it takes to delete snapshots and consolidate the snapshot files depends on the volume of data that the guest operating system wrote to the virtual disks after you took the last snapshot.

If disk consolidation fails when you delete a snapshot or delete all snapshots and you notice a degradation in virtual machine performance, you can view a list of virtual machines to determine if any files require consolidation, and if so, run a separate consolidation operation.

Delete
Use the Delete option to remove a single parent or child snapshot from the snapshot tree. Delete writes disk changes between the snapshot and the previous delta disk state to the parent snapshot.
You can also use the Delete option to remove a corrupt snapshot and its files from an abandoned branch of the snapshot tree without merging them with the parent snapshot.
Deleting a snapshot does not mean you will loose data. It means the contents of the snapshot delta .vmdk files will copied into the regular .VMDK files – and you changes will be saved. With just one snapshot delete and delete all is the same action
Delete  All
commit the data from the snapshots to the base disk and removed the snapshots files.Delete all consolidates and writes changes between snapshots and previous delta disk states to the base parent disk and merges them with the base virtual machine disk. With just one snapshot delete and delete all is the same action
 
Consolidation handles situations where the vSphere administrator (or a backup program) tried to delete (aka "commit") a snapshot, but for some reason the system was unsuccessful in doing so.  When this happens, the VM will keep running from the snapshot and the snapshot will continue to grow. In addition, you would no longer see the snapshot in the Snapshot Manager, but still see snapshot files stored with the VM when you browse the datastore.  The administrator can use "consolidate now" to clean up the orphaned snapshot tree and bring the VM up-to-date, running from only its base disks.
 
To prevent snapshot files from merging with the parent snapshot, for example in cases of failed updates or installations, first use the Go to command to restore to a previous snapshot. This action invalidates the snapshot delta disks and deletes the memory file. You can then use the Delete option to remove the snapshot and any associated files.

When you choose “delete all” the following will happen:

1.       A helper snapshot is created which holds all changes
2.       Snapshot 2 will grow to 40GB at most
3.       Snapshot 1 will grow to 60GB at most
4.       Snapshot 1 will be committed to the original VMDK
5.       The helper is committed to the original
6.       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:

1.       a single snapshot will not grow larger than it’ parent disk
2.       the disk files are not deleted until everything is consolidated
3.       a snapshot will grow in 16MB chunks and every time it grows the VMFS volume will be locked.
 
A snapshot:
  • Represents the state of a virtual machine at the time it was taken.
  • Includes the files and memory state of a virtual machine's guest operating system.
  • Includes the settings and configuration of a virtual machine and its virtual hardware.
  • Is stored as a set of files in the same directory as other files that comprise a virtual machine.
  • Should be taken when testing something with unknown or potentially harmful effects.
  • Is not meant to be a robust method of backup and recovery. If the files containing a virtual machine are lost, its snapshot files are also lost.
  • Negatively impacts the performance of a virtual machine. This is based on how long it has been in place and how much the virtual machine and its guest operating system have changed since the time it was taken. It is not recommended to run production virtual machines off of snapshots on a permanent basis.
  • Can take up as much disk space as the virtual machine itself. If multiple snapshots are possible, the amount of disk space used increases with the number of snapshots in place.

Note: Virtual disks which are configured to be independent-persistent cannot use snapshots.

No comments:

Post a Comment