بزرگترین اندازه برای VM Snapshot
This document is written by Eric Siebert. He has don a good job with it. We treat the following themes; How Vmware snapshots works as How large a virtual machine snapshot grows and deleting Vmware snapshots without wasting space. So have fun with this great article.
HOW VIRTUAL MACHINE SNAPSHOTSWORKS
A disk “snapshot” is a copy of the virtual machine disk file (VMDK) at a certain point in time. It preserves the disk file system and system memory of your VM by enabling you to revert to the snapshot in case something goes wrong. Snapshots can be real lifesavers when upgrading or patching applications and servers. This article will go over everything you need to know about using snapshots with VMware, including what they are, how they work and advanced techniques.
Snapshot disk space used and rate of growth
If you create more than one snapshot of your virtual machine (VM), then you’ll have multiple restore points available to revert to. When you create a snapshot, what was currently writable becomes read-only from that point on. Using in-file delta technology, new files are created that contain all changes (delta) to the original disk files.
The size of a snapshot file can never exceed the size of the original disk file. Any time a disk block is changed, the snapshot is created in the delta file and simply updated as changes are made. If you changed every single disk block on your server after taking a snapshot, your snapshot would still be the same size as your original disk file. Snapshot files will initially be small (16 MB), but will grow as writes are made to the VM’s disk files.
Snapshots grow in 16 MB increments to help reduce SCSI reservation conflicts. When requests are made to change a block on the original disk, it is instead changed in the delta file. If the previously changed disk block in a delta file is changed again it will not increase the size of the delta file because it simply updates the existing block in the delta file.
The rate of growth of a snapshot will be determined by how much disk write activity occurs on your server. Servers that have disk write intensive applications, such as SQL and Exchange, will have their snapshot files grow rapidly. On the other hand, servers with mostly static content ..
HOW LARGE CAN VIRTUAL MACHINE SNAPSHOTS GROW?
On a recent VMTN roundtable podcast the subject of how large a single snapshot can become came up, and whether or not the snapshot can exceed the size of the original virtual machine disk file. I’ve always stated that a single snapshot can never grow larger then the original disk file but others had thought they had seen instances where this had happened. After the discussion, a bunch of us did some testing to reconfirm this, and our results all showed that the snapshot never grew larger then the original disk file despite the amount of data that was changed after the snapshot was taken.
Why is this? 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.
For example, if you took a snapshot of a VM with a 10 GB virtual disk, that snapshot could never grow larger than 10 GB, although it might grow slightly larger if every single disk block was changed because of the extra overhead space included in the snapshot disk file. The initial snapshot starts out small (16 MB) and grows in 16 MB increments up to the maximum size of the original virtual disk as changes are made to it.
In most cases the snapshot will not grow as large as the original disk, because typically operating system and application files are not changed once they are installed and therefore those disk blocks are not changed. If you performed a disk defragment inside the operating system, however, this could quickly and easily grow the size of the snapshot as files are being moved around on the disk which results in them being rewritten in a new location and, subsequently, the disk blocks are updated accordingly.
Now this only applies to a single snapshot. It is possible for the combined disk space total of multiple snapshots to exceed the size of the original disk file. The reason for this is that previous snapshots become read-only when new ones are created. If a particular disk block was updated from a previous snapshot, it would be written as a new block in later snapshots. That same disk block could then exist in multiple snapshots, which could make the combined total of the snapshots greater then the original disk file.
Even though copies of a single disk block can exist in multiple snapshots when it comes time to delete the snapshots, only the latest disk block is written back to the original disk and all of the others are discarded. Likewise, if you revert to a particular snapshot, then the existing disk block is discarded if it has been updated since the snapshot that you are reverting to, and the disk block from that snapshot is used instead.
This may all sound a bit confusing but the moral of this story is that a single snapshot can never exceed the size of the original disk file. For more information on snapshots be sure and check out the three-part series that I wrote about them:
DELETING VIRTUAL MACHINE SNAPSHOTS WITHOUT WASTING DISK SPACE
Taking snapshots of your virtual machines is a useful way to preserve and restore ESX configurations; however, proper management is needed to avoid performance problems. In this tip, we’ll explore advanced snapshot management topics. (For snapshot basics or to review how snapshots work, see my previous tip.)
Disk space and deleting multiple snapshots
It’s important to plan ahead and allow for ample disk space on your VMware virtual machine file system (VMFS) volumes for snapshot files. A good rule of thumb is to allow for disk space of at least 25% of the virtual machine’s (VM’s) total disk size. But this amount can vary depending upon the type of server, how long you keep the snapshots, and if you plan on using multiple snapshots. If you plan on including the memory state with your snapshots, you’ll also need to allow for extra disk space equal to amount of RAM assigned to the VM.
A VM with only one snapshot requires no extra disk space when deleting, or committing, it. (The term committing is used because the changes saved in the snapshot’s delta files are now committed to the original virtual machine disk file, or VMDK.) But if you have multiple snapshots, you will need extra disk space available when deleting all snapshots. This is because of the way they are merged back into the original disk file.
For example, say you were to delete all snapshots on a VM with three snapshots. We’ll call them Snap1, Snap2 and Snap3. First, Snap3 will be merged into Snap2, which will cause Snap2 to grow. Next, Snap2 will be merged into Snap1, which will also grow. Finally, Snap1 will be merged into the original disk file, which requires no extra disk space. The snapshot files are deleted when the original disk file is updated at the very end of the operation, rather than being deleted as each is merged into another. So having a VM with 20 GB of snapshots files could potentially require an additional 20 GB when committing them. If you have an ESX host that …