快照管理
注意:快照本质上是作用于磁盘的。一旦给虚拟机做了快照,其快照文件的大小是不受原磁盘大小限制的,要注意将 DS 耗尽的风险。
当做快照时,原来的 -falt.vmkd 磁盘文件由 R/W 变成 R/O,会生成一个新的 -sesparse.vmkd 文件,如果再做一个快照,之前的文件再次变成 R/O,又会生成一个新的 -sesparse.vmkd 文件。(VMFS5 且磁盘 < 2TB时,是 -delta.vmdk,block size是512bytes,VMFS5 且磁盘 > 2TB或者 VMFS6时,是 -sesparse.vmdk,block size是4K)
Snapshot the virtual machines's memory
Quiesce guest file system (Needs VMware Tools installed)
- 在开机做快照时,如果两个都不勾选,则只对磁盘做快照
- 如果勾选了第一个,则同时会将当时的内存状态保存成一份 .vmem 文件。恢复后,虚拟机是开机的。
- 如果只勾了第二个,则会先将内存数据写入磁盘,然后只对磁盘做快照。恢复后虚拟机是关机的。
- 两个不能同时勾
做完快照后生成的文件:
-Snapshot#.vmsn: Configuration state
-Snapshot#.vmem: Memory state(optional)
-00000#.vmdk: Disk descriptor
-00000#-delta.vmdk: VMFS5 delta
-00000#-sesparse.vmdk: VMFS6 delta
.vmsd: Stores names, descriptions, and relationships for all the VM's snapshots(不做快照也有)
删除某个快照,会向上一级磁盘做整合。
如果删除虚拟机快照后,快照文件没有正常整合,在虚拟机上会有警告,右击虚拟机 > 快照 > 整合(Consolidate),即可将失败的进行整合。
删除快照的过程:
When a snapshot removal (consolidation) is in progress, you cannot perform other VM tasks, such as power operations, or vMotion migration, in the virtual machine. You must remove the snapshot without any interruption to ensure data integrity. Based on the amount of snapshot delta to be committed, the amount of time varies.
For live consolidations, virtual machine activity (specifically disk writes) during this time must also be committed. This delta information is kept in a temporary Consolidate Helper snapshot, committed at the end of the snapshot removal.
For busy virtual machines, the volume of activity may consume system resources for longer than a usual amount of time, resulting in a larger Consolidate Helper snapshot delta.
For example, a virtual machine with one virtual disk (disk.vmdk) and one snapshot, will have these files:
- disk.vmdk with extent disk-flat.vmdk
- disk-000001.vmdk with extent disk-000001-delta.vmdk
If you choose to remove or consolidate the snapshot:
1.An additional snapshot delta is created, the Consolidate Helper:
- disk.vmdk with extent disk-flat.vmdk
- disk-000001.vmdk with extent disk-000001-delta.vmdk
- disk-000002.vmdk with extent disk-000002-delta.vmdk.
The virtual machine is no longer writing to the above two files; all current writes while the snapshot removal is in progress are committed to the disk-000002-delta.vmdk extent file via disk-000002.vmdk.
2.The VMware ESXi host's DiskLib API consolidates disk-flat.vmdk with disk-000001-delta.vmdk. Meanwhile, the virtual machine continues writing to disk-000002-delta.vmdk.
3.After completing the consolidation of the snapshot, the ESXi host consolidates the Consolidate Helper disk-000002-delta.vmdk with disk-flat.vmdk.
4.The Virtual Machines are stunned for the duration of the consolidate. In typical circumstances, this process is completed almost immediately. A VM with considerable amounts of delta gathered in the temporary snapshot are stunned for a noticeable or disruptive amount of time. This can have adverse effects on guest applications or services.
5.When all delta information recorded in disk-000002-delta.vmdk has been committed to disk-flat.vmdk, disk-000002-delta.vmdk and its descriptor file disk-000002.vmdk are removed from the datastore. The virtual machine continues from its base disk or selected point.