Hyper-V uses the Volume Shadow Copy Service (VSS) to backup and restore virtual machines (VMs). If the backup (volume snapshot) integration services are installed in the guest operating system, a VSS requester is installed that will allow VSS writers in the guest operating system to participate in the backup of the VM. For details, see the following sections:
hyper - v使用卷影拷贝服务(VSS)备份和恢复虚拟机(vm)。如果备份(卷快照)集成服务是安装在来宾操作系统(虚拟机中的操作系统的代称),一个VSS的请求被安装目的在于允许VSS的写入也参与虚拟机操作系统的备份。有关详细信息,请参见下面的部分:备份虚拟机
恢复虚拟机
故障转移集群和VSS hyper - v
详细介绍 hyper - v VSS 写入
相关主题
Backing Up the Virtual Machines备份虚拟机
Hyper-V uses one of two mechanisms to backup each VM. The default backup mechanism is called the "Saved State" method, where the VM is put into a saved state during the processing of the PrepareForSnapshot event, snapshots are taken of the appropriate volumes, and the VM is returned to the previous state during the processing of the PostSnapshot event.
The other backup mechanism is called the "Child VM Snapshot" method, which uses VSS inside the child VM to participate in the backup. For the "Child VM Snapshot" method to be supported, all of the following conditions must be met:
hyper - v使用两种机制来备份每个VM。默认的备份机制被称为“状态保存法”。虚拟机首先保存一个状态在处理准备快照之前,接下来快照记录合适的卷信息,虚拟机在回到之前的快照时间之前的状态。
另一个备份机器的方法叫:“子虚拟机快照”方法,通过在子虚拟机的备份中使用VSS的参与,对于子虚拟机快照的方法的支持必须符合下列条件:Backup (volume snapshot) Integration Service is installed and running in the child VM. The service name is "Hyper-V Volume Shadow Copy Requestor".
Windows 2000: Backup Integration Service is not supported.
The child VM must be in the running state.
The Snapshot File Location for the VM is set to be the same volume in the host operating system as the VHD files for the VM.
All volumes in the child VM are basic disks and there are no dynamic disks.
All disks in the child VM must use a file system that supports snapshots (for example, NTFS).
备份(卷快照)集成服务是安装和运行在孩子VM。服务的名字是“hyper - v卷影副本请求者”。
Windows 2000:备份集成服务不支持。
孩子必须在VM的运行状态。
快照文件位置的VM将是相同的体积在主机操作系统作为VHD文件为虚拟机。
所有卷在孩子VM是基本磁盘和没有动态磁盘。
在孩子的所有磁盘必须使用文件系统的VM支持快照(例如,NTFS)。
In general, the process for backing up VMs is the same as described in . The unique behavior happens when the Hyper-V VSS writer (part of the "Hyper-V Virtual Machine Management" service) processes the PrepareForSnapshot event. If the backup was done using the "Child VM Snapshot" method, there is additional processing done but it is not visible to the child VM.
The following procedure describes how to back up VMs.
一般来说,备份虚拟机的过程和在VSS下概述备份的过程是一样的。独特的行为发生在当hyper - v VSS写入(部分“hyper - v虚拟机管理”服务)处理准备快照事件。如果备份是通过使用“子虚拟机快照”方法,有额外的处理做的,但是对于子虚拟机不可见。
下面的过程介绍如何备份虚拟机。For each VM in the writer metadata, if the "Saved State" method is used, the VM is put into a saved state. For VMs using the "Child VM Snapshot" method, the Hyper-V Volume Shadow Copy Requestor Service in the child VM processes the backup as detailed in . All VSS events in the child VM occur during the host operating system processing of the PrepareForSnapshot event.
对于每个虚拟机写入的元素,如果使用了保持状态的方法,虚拟机将会进入一个保持状态。对于使用子虚拟机快照的方法,备份将会使用卷影拷贝(VSS),子虚拟机所有的卷影拷贝(VSS)事件将会发生在主机的快照前处理事件之前。 After all VMs have either been put in the saved state or had snapshots taken, the Hyper-V VSS writer returns from the PrepareForSnapshot event. No processing is done by the Hyper-V VSS writer during the Freeze and Thaw events.
When the Hyper-V VSS writer processes the PostSnapshot event, VMs that were backed up using the "Saved State" method and were put into a saved state by the Hyper-V VSS writer are returned to the state they were in before the backup started. For the VMs that were backed up using the "Child VM Snapshot" method, the host p_w_picpath of the VHD files that had the snapshots taken are rolled back to the snapshot taken during the processing of the PrepareForSnapshot event. This processing is done independently of the VSS writers in the child VMs so the snapshots taken must be auto-recoverable. (VSS_VOLSNAP_ATTR_NO_AUTORECOVERY is not set in the context.)
当处理Hyper-v的VSS写入处理快照后的事件,虚拟机将会使用保持状态的方法,并且通过VSS写入保持,然后返回到写入前的状态,当使用“子虚拟机快照”的方法,主机的VHD文件快照将会回滚到处理快照准备的事件。这种处理是子虚拟机的VSS写入地理完成的。因此快照一定是自动回滚的(VSS_VOLSNAP_ATTR_NO_AUTORECOVERY没有设置在上下文)。 Partial backups are not supported. If any VM fails to create a snapshot, no VMs will be backed up. 如果虚拟机不能创建快照或者创建快照失败,这些机器的备份是不能够执行成功的。 Note : Pass-through and iSCSI disks are not visible to the host operating system and therefore not backed up by the Hyper-V VSS writer. Backups of these volumes must be done entirely within the VM. 注意: 直连和iSCSI磁盘不可见,因此宿主操作系统不支持hyper - v VSS写入。备份这些卷必须做完全在VM层面上。
Restoring the Virtual Machines恢复虚拟机
Restoring the VMs is done entirely by the host operating system; the VSS writers in the child VMs are not involved.
恢复虚拟机做完全由主机操作系统;子虚拟机的VSS不涉及。The following procedure describes how to restore VMs.
下面的过程介绍如何恢复虚拟机。During the processing of the PreRestore event, the Hyper-V VSS writer turns off and deletes any VMs that are about to be restored. 在处理PreRestore事件,hyper - v VSS写入关闭和删除任何即将被恢复的虚拟机。
After all VSS writers have processed the PreRestore event, the files are restored. VSS写入处理每一个恢复的事件文件的恢复。
During the processing of the PostRestore event, the Hyper-V VSS writer calls the method. If the return is not VSS_RS_ALL, then the Hyper-V VSS writer calls the method and returns FALSE from the method. 在处理PostRestore事件时,hyper - v VSS写入调用 IVssComponent::GetFileRestoreStatus方法。如果返回的不是 VSS_RS_ALL,,然后调用theSetWriterFailure方法 并且返回错误通过 .
For each VM that was restored, the Hyper-V VSS writer registers the VM with the Hyper-V management service. If the VM is restored to a nondefault location, a symbolic link is created in the default location linking to that location.
For each VHD that was restored, the location is compared with the one specified for that VM. If the location is different, then the configuration is updated with the proper location. 对于每个虚拟机的恢复,hyper - v VSS写入登记VM与hyper - v管理服务。如果虚拟机恢复到非默认的位置,创建一个符号链接到该默认位置。 对于每个VHD的恢复,VHD的位置与一个指定的VM相关联。如果这个位置是不同的,那么将从合适的位置获得配置。
The network configuration is updated. If the virtual switches that the VM was connected to when it was backed up still exit, new ports are created and connected to the VM.
网络配置更新。如果虚拟的交换机网络是联通的,那么当其被恢复后仍然存在,新的端口号将会被创建和其虚拟机相联通。
Failover Clustering and Hyper-V VSS故障转移集群和VSS hyper - v
The Hyper-V VSS writer does not give any consideration to VMs that are part of a failover cluster. During both the "Saved State" method backups and all restores, the VM would be put into the saved state or deleted entirely. This would be seen as a failure by the clustering service and cause the applications on those nodes to be failed over to other nodes. To avoid this during "Saved State" backups, the VM state must be saved using the clustering service. To avoid this during a restore, the resources on the VM would need to be taken offline.
Details on the Hyper-V VSS Writer详细描述 hyper - v VSS写入
Writer Name: Microsoft Hyper-V VSS Writer
Writer ID: 66841cd4-6ded-4f4b-8f17-fd23f8ddc3de
作者名称:微软hyper - v VSS作家
作者ID:66841 cd4-6ded-4f4b-8f17-fd23f8ddc3de