Chinese name: snapshot uses, file size, growth rate, snapshot types, snapshot creation, steps, processes, deletion and recovery, deletion and recovery, management tools, potential problems contained in snapshots, avoiding multiple snapshots as much as possible, repairing VMDK files with VMware snapshots, working principle of VMware snapshots, whether VMware snapshots can repair VMDK files, The missing file type of VMware snapshot determines whether it can be restored, how to use it, the traditional snapshot of VMware snapshot, the snapshot memory state of VMware snapshot, the problems of VMware snapshot, and the snapshot use during VMware snapshot. If you create multiple virtual machine snapshots, you will have multiple recovery points to restore. When a snapshot is created, it becomes read-only when it can now be written. In-file incremental technology can be used to create a new file to record all changes (increments) about the original disk file. File Size The size of the snapshot file cannot exceed the size of the original disk file. Whenever a disk block changes, a snapshot is created in the delta file and can be updated according to the change. If you change each individual disk storage block after taking a snapshot, the snapshot will still be as big as the original disk file. The snapshot file is initially small (16MB), but it will increase as you write to the virtual disk file. 16MB snapshot space is used to reduce SCSI reservation conflicts. When a request to change a storage block on the original disk is received, it replaces the change in the delta file. If the disk storage block previously changed in the delta file is changed again, it will not increase the size of the delta file because it only updates the existing storage block in the delta file. Growth rate The growth rate of snapshots is determined by the number of disk write activities on the server. Snapshot files of servers with enhanced disk write applications, such as SQL and Exchange servers, are growing rapidly. On the other hand, most servers with static content and a small amount of disk writing (such as Web and application servers) have a low growth rate of snapshot files. When you create many snapshots, a new delta file is created and the original delta file becomes read-only. Each incremental file containing a large number of snapshots may become as large as the original disk file. Snapshot Type This is a specific file when you create a snapshot of a virtual machine. It is also a redo log. The delta file is a bitmap changed on the underlying VMDK (virtual machine disk), so its size cannot exceed VMDK. When each snapshot is created for a virtual machine, an incremental file is created. When snapshots are deleted or restored in snapshot management, these files will be automatically deleted. These archives are used to store metadata and information about snapshots. This file is in text format and contains information such as snapshot display name, UID (number) and disk file name. Before the virtual machine snapshot is created, the initial size of this file is 0 bytes. In this way, as long as you take a snapshot, the file will grow and be constantly updated. After deleting the snapshot, the file cannot be completely erased. After deleting a snapshot, it still reserves a location for each snapshot in the file, but only adds the number and name to the Consolidation Helper, which can be used to consolidate backups *. Vmsn file, which is a snapshot status file, stores the accurate running status of the virtual machine when snapshots are used. The size of this file depends on whether you choose to store this virtual machine as part of the snapshot. If you choose to keep the storage of the virtual machine, this file will be larger and then allocated to the maximum RAM of the virtual machine. This file is similar to the VMware pause status file. vmss。 Each snapshot of the virtual machine will create a; vmss file; These files are automatically deleted when the snapshot is moved. Steps to Create Snapshots You can create snapshots through the Snapshot Manager in VMware Infrastructure Client (VI Client) or directly by using the command-line tools on the ESX service console. Use the command to start or shut down the virtual machine. You can also pause a virtual machine while creating a snapshot. If the virtual machine is turned off, you will not be able to choose to take a snapshot of the virtual machine storage. This process manages snapshots by using a VI Client directly connected to an ESX server or VirtualCenter. If you choose to use the command line interface, the syntax for creating snapshots is "vmware-cmd createsnapshot", for example, "VMware-cmd myvm 1.vmx creates snapshot snap 1 before upgrading'1'". The options for pause and storage are 1 or 0. Selecting 1 will stop writing to the file system before taking a snapshot. Select 1 store snapshot virtual machine storage state. If multiple snapshots are created, once a new snapshot is created, the previous snapshot will become read-only. Delete Restore When deleting all snapshots of a virtual machine, all incremental files created will be merged into the original VMDK disk file of the virtual machine and then deleted. If you choose to delete only a single snapshot, it will be merged into its parent snapshot. If you choose to restore the snapshot, the current disk and storage state will be discarded, and the virtual machine will be restored to the state when the snapshot was taken. No matter which snapshot you restore, it will become the new parent snapshot. However, the parent snapshot is usually not the latest snapshot. If you revert to an old snapshot, it will become the parent snapshot of the current state of the virtual machine. You can see this parent snapshot in the Snapshot Manager with a label "Here you are" under it. You can use the VI Client or vmware-cmd command-line tools to delete or restore snapshots. The snapshot manager in VI Client provides greater flexibility and is easier to use than CLI. An important difference between the "Restore to Snapshot" option in VI Client and Snapshot Manager is that the restore option only restores to the last snapshot, while Snapshot Manager can flexibly choose to restore to a specific snapshot. This is called "Go to in Snapshot Manager". Restore If you use vmware-cmd, the syntax is "VMware-cmd remove snapshot", you can delete all snapshots, and "vmware-cmd revertsnapshot" can be restored to the last snapshot. If you need to delete or restore a specific snapshot, you must use the VI Client. If you restore a snapshot that does not contain a storage state, the server will shut down and once restarted, the previous snapshot will be used. If the snapshot includes a storage state, the virtual machine will pause and then return to the disk and storage state of the previous snapshot. Although the management tool does not need VMware Tools when using snapshots, it is highly recommended. VMware Tools allows the operating system to stop or reduce disk activity, making it easier to take snapshots without the VMware host creating a copy of the PIT. There are many ways to check the snapshot file size. The simplest way is to use RVTools or enable the snapshot size function. You can also execute the following command in PowerCLI: get-vm | get-snapshot, which lists all snapshots in the target vCenter. Potential problems contained in snapshots If you try to move a virtual machine other than vMotion or Storage vMotion, snapshots may cause some problems. Although you can use the copy command to copy any file, if you use this method on a virtual machine with snapshots, it will lead to file damage and so on. There are several types of virtual machines that cannot take snapshots. These include virtual machines that use SCSI buses, such as cluster servers. And you can't take a snapshot of a single disk. If physical raw device mapping is enabled, you will not be able to create snapshots for it because the underlying disks are managed by virtual machines. That is, you cannot create a snapshot for a VMware host unless it is managed by that host. If you are running ESXi 4 or earlier, you need to pay attention to some other issues. First, you cannot migrate a virtual machine with multiple snapshots using Storage vMotion technology. The fastest solution is to consolidate all snapshots, which means that virtual machines can no longer be restored to multiple points in time. This restriction has been removed in vSphere 5. Another common problem is that when consolidating large snapshots, the host will be temporarily silent, but the virtual machine on the host is still running normally and will disappear automatically after a period of time. Try to avoid multiple snapshots. In most cases, you should avoid creating multiple snapshots of the same virtual machine. Every time a new snapshot is created for the system, it will run slower. Each snapshot will create a corresponding incremental disk file. If the virtual machine needs to read multiple delta files, it will inevitably increase the I/O load of the system. This process will undoubtedly prolong the echo time of the virtual machine and generate additional disk operations. If you only want to save the latest version of a series of snapshots, you can integrate them into a single snapshot. This way is helpful to improve the running speed and management efficiency of the system. Select the destination virtual machine, right-click, and select Merge. You can query whether virtual machines need to be integrated in the Virtual Machines and Templates view, and display all virtual machines that need to be integrated in the list. The working principle of VMware snapshot to repair VMDK file
When we created a VMware snapshot, we didn't actually copy any data from the original disk. Instead, the original disk is set to the VMware snapshot read state, and a VMware snapshot rollback log, sometimes called an incremental disk, is created, which is actually a placeholder for any virtual machine write operation after the VMware snapshot is created. Figure 1. The delta file contains only the virtual machine changes since the snapshot was created. Figure 1 shows the workflow of VMware snapshot. Suppose the disk contains the word "SNAPSHOT" and each letter is located in its own VMware snapshot disk block. When we create a VMware snapshot of a disk, the original disk becomes read-only and a new incremental VMDK file is created. At this time, the second block becomes "L", and the ninth block is added with "S", thus producing a new word "SLAPSHOTS".
In order to ensure that all VMware snapshot files are safe, we need to do a series of operations. We can delete the VMware snapshot, which will only merge the new data blocks into the original VMDK file and submit the "snapshot" to the virtual machine, or we can roll back to another point in time, such as when the disk has just been read into the "snapshot". Every time a VMware snapshot is created, a new incremental disk is created to ensure that we can roll back to any point in the VMware snapshot chain. Can VMware snapshots repair VMDK files?
If the original VMDK file is destroyed or deleted, the VMware snapshot administrator will face many thorny problems. As shown in Figure 2, the original VMware snapshot disk containing the "snapshot" has disappeared. Now we only have incremental disks with letters "L" and "S" in our hands, and the metadta pointing to these disks has disappeared. Figure 2. If you only use VMware snapshots that contain damaged or missing VMDK files, you cannot rebuild the original files.
Perhaps you have concluded that if the original VMware snapshot disk or the original data block containing the "snapshot" is lost, nothing can be reconstructed with some data in the incremental disk. The missing file type of VMware snapshot determines whether it can be restored.
It is impossible to recover the lost VMDK file only by using VMware snapshot file, but we may have several solutions according to the lost VMDK file. VMware snapshot virtual machine disk consists of two different files: VMDK file (the most important part of virtual disk, which holds all data) and descriptor file (VMX file), which provides relevant VMware snapshot disk information for virtual machine configuration file.
If the VMDK file is lost, you can only hope to save the VMware snapshot backup file; If the descriptor file is lost, you can use the ESXi command line to recover it. How to use VMware snapshots VMware snapshots can help you avoid a lot of trouble. VMware snapshots are not backups. The role of VMware snapshots is confused by many people, and VMware snapshots have caused them endless trouble. In order to understand what a VMware snapshot is, we need to define what a VMware snapshot is. There is no doubt that VMware snapshots are not backups. Backup is designed for long-term storage and can be recovered in case of data loss and file damage. Many people who have used Office applications are familiar with the undo function. This function allows you to take a step back at the exact time you want to choose when the work is finished. However, VMware snapshots have no undo function. Now you know what a VMware snapshot is not. A VMware snapshot is a point in time of a virtual machine. VMware snapshot is not an ordinary automation project; VMware snapshots are manually created at a certain point in time, and VMware snapshots can also jump back to that point in time. After this "point in time" is created, the virtual machine will continue to run, and the administrator can continue to run existing tasks. If the upgrade fails, the administrator can restore the virtual machine to the point in time before the upgrade. This sounds a lot like the undo function, and it can indeed be restored to the previously created point in time. There are usually two types of snapshots available: traditional snapshots of VMware snapshots. Traditional VMware snapshots cannot capture the current memory state of virtual machines. This type of VMware snapshot is usually fast, because VMware snapshots do not contain active projects. When creating a VMware snapshot, there is no need to pause the running virtual machine. If the administrator chooses to restore the virtual machine to a VMware snapshot, the virtual machine must be restarted like a normal shutdown and restart. Snapshot Memory Status of VMware Snapshot This type of VMware snapshot captures the memory status of virtual machines and other activities (disk, I/O, network) when taking snapshots. This VMware snapshot takes a long time to execute, but it has an additional benefit: if you revert to this VMware snapshot, the virtual machine will return to the exact point in time when you created it; If the virtual machine is still running when you create a VMware snapshot, the VMware snapshot will continue to run at the exact point in time when you create the VMware snapshot. VMware Snapshot Problem Another powerful function of VMware Snapshot is that if your virtual machine is used improperly, VMware Snapshot can help you eliminate mistakes. Now that we know what a VMware snapshot is and how it works, let's look at some things you shouldn't do. A VMware snapshot is a point in time, which means it is only temporary. Now, people have different definitions of temporality, and this is the problem. That incremental change file records all the changes of the virtual machine: if it is a busy virtual machine, the incremental change file of VMware snapshot will become bigger and bigger. The incremental change file is stored in the database server, and deleting large or long-term snapshots through VMware Snapshot is a process of recording all incremental change files of the original VMDK file. VMware Snapshot For small incremental change files, this process is relatively simple, but for large VMware snapshots, this process will cause the virtual machine to pause, or the application of changes to the original VMDK will pause for a few seconds or minutes. The advantages and disadvantages of VMware snapshots are closely related. VMware snapshots allow administrators to switch back and forth in the same virtual machine at different times, creating an experience similar to the undo function. But the problem is that the more VMware snapshots, the more incremental change files, which will increase the possibility of corruption.