Hyper-V Server virtual machine Snapshot (checkpoint)

Source: Internet
Author: User

Windows Server 2012/R2 uses Microsoft Volume Copy Service technology to make a real-time snapshot of the virtual mechanism running on Hyper-V, the state, data, and hardware configuration of the virtual machine. Each virtual machine can produce up to 50 snapshots.

Snapshots are primarily used to test changes to an existing virtual machine environment, as necessary, as a means to return to a previous state or time. If you need to rebuild a particular state or reproduce a particular condition to troubleshoot a problem, it is useful to have a more convenient way to recover the virtual machine.

In a real-world production environment, snapshots can assist administrators in making system updates to servers or updating a particular software. If there is a problem during a system update or a software update, you can use the snapshot to revert to a previously healthy state. Another major use of snapshots is fault tolerance and disaster recovery. In a real-world environment, a snapshot of the time before a disaster can help businesses quickly restore the server to production, saving valuable time needed to recover from tape. Before you take a snapshot of the virtual machine for the first time, set the folder where the snapshot for the virtual machine resides. If the virtual machine snapshot is not set, the virtual machine snapshot file is saved in the same folder as the virtual machine host file. However, this operation suspends the running virtual machine, causing the virtual machine to be unavailable during the merge process.

650) this.width=650; "height=" 387 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/76/ Wkiom1sdbpwhatdlaae_ws2ra5u866.jpg "border=" 0 "/>

The system defaults to: "C:\ProgramData\Microsoft\Windows\Hyper-V\Snapshots"

Starting with Windows Server 2012, the real-time merge feature of Hyper-V now allows the organization to merge the current snapshot back into its original parent disk while keeping the virtual machine running. The snapshot data file (the current leaf node of the virtual hard disk, which is derived into the read-only differential parent disk) is stored as a. avhd file. When you delete a snapshot, you cannot delete the associated. AVHD disk if the virtual machine is running. Windows Server 2012 begins to support the ability to merge the associated. AVHD disks into the parent disk when the virtual machine continues to run.

During the process, I/O is hung in a small range, and the data in this range is read from the source and written to the target. In the process of leaf merging, subsequent writes to the merged regions are redirected to the merge target. When completed, the online merge modifies the run chain, cancels the link to the merged disk, and closes the files. Has no effect on the user. Real-time consolidation of snapshots provides a faster and easier way to restore a virtual machine back to its previous state.

Enterprise administrators can create virtual machine snapshots at any time without impacting business systems, test environments, and so on, when the snapshot is created, the system is automatically embedded in the snapshot tree of the virtual machine and generated. AVHD/.AVHDX virtual hard disk files and generate a snapshot file to the appropriate directory

650) this.width=650; "height=" 215 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/76/wKiom1SDBpXD6_ Fzaacqogi7r94343.jpg "border=" 0 "/>

650) this.width=650; "height=" 143 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/76/ Wkiom1sdbpxtml64aacok3jvj_s026.jpg "border=" 0 "/>

The configuration information for the virtual machine is saved to the snapshot file, and a GUID is used to identify the virtual machine

650) this.width=650; "height=" 501 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/54/76/ Wkiom1sdbpbho5hjaamqft2yysm112.jpg "border=" 0 "/>

To create a virtual machine snapshot using the Hyper-V management Console

1. Log in to the Hyper-V server, open the Hyper-V management Console, right-click the virtual machine where you want to create the snapshot, select Checkpoint

650) this.width=650; "height=" 260 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/74/ Wkiol1sdbyfg0nvtaadbwpsp06c375.jpg "border=" 0 "/>

2. After performing a checkpoint, the system automatically creates a snapshot and identifies the snapshot file name with the creation time, which can be identified according to the actual environment. For example, "Cleanos" is a clean system and no information is configured

650) this.width=650; "height=" 258 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/74/ Wkiol1sdbyecwln6aadp7fxgbcu760.jpg "border=" 0 "/>

3. Right-click the snapshot, select settings to view the checkpoint file location, or view the relevant actions that can be performed

650) this.width=650; "height=" 375 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/54/76/wKiom1SDBpeB-hY_ Aafvvz3qfhq066.jpg "border=" 0 "/>

650) this.width=650; "height=" 315 "title=" image "style=" Border:0px;padding-top:0px;padding-right:0px;padding-left : 0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/76/wKiom1SDBpihjwU_ Aacwsloyvb8372.jpg "border=" 0 "/>

To create a virtual machine snapshot using Windows PowerShell

1. Run PowerShell as an administrator

2. Execute the following statement to create a virtual machine snapshot

Checkpoint-vm-name Bj-cli-03-snapshotname Cleanos

650) this.width=650; "height=" 94 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/74/ Wkiol1sdbyncazrbaacqfirknto259.jpg "border=" 0 "/>

3. Return to Hyper-V Manager to view the virtual machine "bj-cli-03" snapshot created

4. Use the Remove-vmsnapshot statement to delete a virtual machine snapshot

5. Use the tree/f command to view the virtual machine file structure under cmd
650) this.width=650; "height=" 473 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/54/74/ Wkiol1sdbymhrgqpaaha2mz8e8w652.jpg "border=" 0 "/>

6. View virtual machine snapshots using PowerShell

650) this.width=650; "height=" 141 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/74/ Wkiol1sdbyqynjruaadfe9ddi6w743.jpg "border=" 0 "/>

One, restore and apply virtual machine snapshot

1. Restore the snapshot:

A common scenario is a monthly system Patch update, and enterprise administrators often use one or the same type of machine for system updates before a monthly system update to ensure that the business system is not affected. At this point, if the administrator creates a snapshot before the system update is performed, you can use the snapshot Restore feature to revert to the previous normal state when the system fix is complete, the system crashes, an error occurs in the operation, or the file is deleted by mistake.

The restore feature can only fall back to the previous point in time when the virtual machine is running and cannot be restored at any point in time. Right-click the virtual machine and select Restore to perform a restore of the virtual machine snapshot

650) this.width=650; "height=" 423 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/76/ Wkiom1sdbprqh-0paahrltodsvo690.jpg "border=" 0 "/>

2. Apply the snapshot:

The restore snapshot feature can only be restored to the virtual machine snapshot that was performed at the previous point in time. If you want to revert to a virtual machine snapshot at any point in time, you can use app features. Right-click on the snapshot you created and select "Apply" to

650) this.width=650; "height=" 422 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/74/ Wkiol1sdbyyglpnwaagr96gcduo749.jpg "border=" 0 "/>

650) this.width=650; "height=" 165 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M02/54/76/ Wkiom1sdbpubkcigaacugdq2acu907.jpg "border=" 0 "/>

1) Select "Apply": Automatically shut down the virtual machine and then restore the virtual machine

2) Select "Create Checkpoint and apply": Create a snapshot of the current state of the current virtual machine and perform a restore of the virtual machine

Second, delete the virtual machine snapshot

Deleting a virtual machine snapshot can save physical disk space, such as the above, after the system Patch update is complete, there is no impact on the current business system, you can delete the virtual machine snapshot, during the execution of the delete snapshot, Hyper-V automatically performs a disk merge. Merges the snapshot hard disk files that are being deleted with the hard disk files of the parent snapshot.

1. Virtual machine closed Delete Snapshot

Select a snapshot of the virtual machine where you want to delete the snapshot, and right-click Delete checkpoint to delete the virtual machine snapshot

650) this.width=650; "height=" 422 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/54/76/ Wkiom1sdbpzxa8g1aagm7hgxdk8655.jpg "border=" 0 "/>

2. Deleting a snapshot in a virtual machine run

As mentioned earlier, merging snapshot files before hyper-v3.0 must shut down the virtual machine, and after hyper-v3.0, you can delete and merge the virtual machine snapshots in the virtual machine run to reduce server downtime. One thing to note is that in a virtual machine run, you need to choose to delete the checkpoint tree to completely delete the snapshot and merge the snapshot files

650) this.width=650; "height=" 314 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M01/54/76/ Wkiom1sdbp2t6urfaadh90zhaja683.jpg "border=" 0 "/>

650) this.width=650; "height=" 196 "title=" image "style=" margin:0px;border:0px;padding-top:0px;padding-right:0px; Padding-left:0px;background-image:none; "alt=" image "src=" http://s3.51cto.com/wyfs02/M00/54/76/ Wkiom1sdbp3gw9fpaabysu4ifpu971.jpg "border=" 0 "/>

Iii. problems that may arise in the production environment

The snapshot feature in virtualization is a good feature of the administrator implementation process, but there are also many problems.

1. Unable to restore the specified file: This problem typically occurs when an administrator mistakenly performs an action that may only revert to the system state when the snapshot was created. It is recommended that the Administrator perform this action when it is confirmed to be correct.

2. Excessive disk space: After the virtual machine snapshot is executed, the. avhd/.achdx file is generated, and as the snapshot grows, the new data is dynamically written to the snapshot file. Recommends that administrators periodically clean up snapshot files that are no longer needed and obsolete

3. Increase the system load: After a virtual machine has created n snapshot files, if the system needs to perform a retrieval function, it is necessary to query in multiple snapshots and subtrees to find the required data, increase disk I/O operations, and allocate more physical resources to complete this operation, which will reduce system performance.

4. Snapshot is not a backup solution: A snapshot simply saves the system to a current state and cannot be used as a backup solution, the application running in the virtual machine does not recognize the snapshot and may not be able to fall back to the pre-modified state when a critical change is performed

This article is from the "Xu Ting blog" blog, make sure to keep this source http://ericxuting.blog.51cto.com/8995534/1587181

Hyper-V Server virtual machine Snapshot (checkpoint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.