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的寫入也參與虛擬機操做系統的備份。有關詳細信息,請參見下面的部分: html
Related topicspost
備份虛擬機this
恢復虛擬機spa
故障轉移集羣和VSS hyper - v操作系統
詳細介紹 hyper - v VSS 寫入3d
相關主題
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 Overview of Processing a Backup Under VSS. 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 Overview of Processing a Backup Under VSS. 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 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 IVssComponent::GetFileRestoreStatus method. If the return is not VSS_RS_ALL, then the Hyper-V VSS writer calls the SetWriterFailure method and returns FALSE from the OnPostRestore method.
在處理PostRestore事件時,hyper - v VSS寫入調用 IVssComponent::GetFileRestoreStatus方法。若是返回的不是 VSS_RS_ALL,,而後調用theSetWriterFailure方法 而且返回錯誤經過 OnpostRestore .
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