• Aucun résultat trouvé

Manually Backing Up and Recovering a Virtual Machine

You can accomplish backup and recovery a number of ways. We’ll devote the remainder of the chapter to walking through two low-cost options for parent-based/host-based backup and recovery using Windows Server Backup and a manual process using VSS via the Diskshadow command.

Windows Server Backup

As noted earlier, WSB is the backup and recovery tool integrated into Windows Server 2008. You can easily use WSB to back up and recover Hyper-V hosts and child VMs. WSB requires that you back up all volumes associated with Hyper-V to facilitate a recovery. This means that you must replicate the entire volumes housing any VM-related files as part of a single backup. The WSB

Manually Backing up and RecoveRing a viRtual Machine

|

131

requirement to capture all data can substantially increase the overall time and storage to com-plete a backup. However, WSB does offer a vastly simpler backup and recovery experience.

wsB i

nstallationand

C

onfigUration

WSB is an installable feature of Windows Server 2008. To add WSB to an existing Windows Server 2008 system, select Features in the bar on the left side of the Server Manager console (see Figure 7.6), and then select Add Features to start the Add Features Wizard.

The command-line tools aren’t installed by default when you install WSB. To install these NOTE

tools, expand the Windows Server Backup Features selection and select Command-Line Tools, as shown in Figure 7.6.

You can also install WSB from the command line using OCSetup:

OCSETUP WindowsServerBackup

WSB is VSS aware, but Hyper-V doesn’t by default register its associated VSS writer with WSB. Without knowledge of the Hyper-V VSS writer (or other application-aware VSS writers) WSB may be unable to successfully complete a VSS snapshot operation for running VMs dur-ing a backup. To register the Hyper-V VSS writer with WSB, add appropriate Registry keys by executing the following two commands:

reg add “HKLM\Software\Microsoft\windows nt\currentversion\i

WindowsServerBackup\Application Support\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}”

Figure 7.6 Add Features Wizard

reg add “HKLM\Software\Microsoft\windows nt\currentversion\i

WindowsServerBackup\Application Support\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}” i /v “Application Identifier” /t REG_SZ /d Hyper-v

After you complete the Registry changes, you can review them using a graphical Registry tool such as the Registry Editor (RegEdt32), as shown in Figure 7.7.

You can also check the entry by querying the Registry:

reg query “HKLM\Software\Microsoft\windows nt\currentversion\i

WindowsServerBackup\Application Support\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}” i /sWindows Server Backup Graphical Interface

You can access WSB through the Administrative Tools program group on the Start menu (Start  Administrative Tools  Windows Server Backup). The WSB console is a fairly typical MMC 3.0 snap-in and should look familiar. You can access administrative actions either from the menu bar at the top or via the Actions pane on the right (see Figure 7.8).

Figure 7.7 Registry entries

Figure 7.8 Windows Server Backup console

Manually Backing up and RecoveRing a viRtual Machine

|

133

You can configure two types of backup processes through the graphical user interface: a Backup Once process and a Backup Schedule. The Backup Schedule action must use a locally attached disk as the backup destination, and a volume must be dedicated for use by WSB. The Backup Once action has options similar to those of Backup Schedule, but you can use either locally attached storage or a network share as a backup destination. Local volumes used as a destination for Backup Once don’t need to be dedicated to WSB.

ISCSI has changed what may constitute a locally attached disk. Mounting volumes across NOTE

local area network (LAN) and even wide area network (WAN) links as if they were internal to a system with iSCSI lets you easily add remote storage to a system for backup/restore and other needs. Chapter 8, “High Availability,” includes iSCSI command examples (using iscsicli) that you can use to attach volumes as part of a scheduled backup and recovery process.

B

aCkUp

o

nCe

You can start a one-time manual backup by selecting the Backup Once action. The Backup Once Wizard walks you through the configurable options (see Figure 7.9); the first choice is to per-form a predefined scheduled backup or to select Different Options.

Selecting Different Options lets you create a customized backup set. This may be the only option available if no predefined scheduled backups exist. As you proceed through the wizard, you can select volumes to include within the scope of the backup—typically, all attached volumes or a custom subset (see Figure 7.10).

Figure 7.9 Backup Options dialog

You can reduce the size and time of the backup by choosing which volumes to include or exclude. If you plan to use a local volume as the backup destination, you should exclude it from the scope of the backup. Remember that all volumes used for Hyper-V VMs must be selected to be within scope of the backup. In Figure 7.11, all Hyper-V related files are housed on C:, and this is the only volume that will be backed up.

As mentioned earlier, a one-time backup may use a network share or non-dedicated local vol-ume as a destination (see Figure 7.12).

Figure 7.10 Select Backup Configuration dialog

Figure 7.11 Select Backup Items dialog

Manually Backing up and RecoveRing a viRtual Machine

|

135

If you want to use a local volume, you can select eligible volumes from a pull-down menu.

You can use removable disks (USB or eSATA) as well as other forms of direct attached storage (see Figure 7.13).

Some application backups let you clear/truncate the transaction log files as part of the backup process. The Specify Advanced Option dialog has no affect on Hyper-V backups, and you can ignore it—select either option (see Figure 7.14).

Figure 7.12 Specify Destination Type dialog

Figure 7.13 Select Backup Destination dialog

After you choose your configuration options, you must confirm the initiation of a backup (see Figure 7.15).

After the backup begins, its status is reflected in the wizard. You may close the wizard at any time while the backup is executing without affecting the backup’s progress (see Figure 7.16).

Figure 7.14 Specify Advanced Option dialog

Figure 7.15 Confirmation dialog

Manually Backing up and RecoveRing a viRtual Machine

|

137

B

aCkUp

s

ChedUle

The process for creating a Backup Schedule is similar to the Backup Once process; we won’t include the flow of the schedule wizard here. As the name suggests, this action lets you define backup processes that execute on a regularly scheduled basis—either once a day or more than once a day. Remember that scheduled backups require a dedicated volume, unlike one-time backups. WSB reformats the volume you select as the backup destination, and all data contained on the volume is destroyed (see Figure 7.17).

p

erforminga

B

aCkUp

U

singthe

C

ommand

l

ine

Extensive line support is provided for WSB via the WBadmin command. The command-line tools provide increased flexibility for scheduling and managing backup and recovery processing; we won’t cover them here. Documentation of the WSB command-line tools is avail-able online at http://technet.microsoft.com/en-us/library/cc754015.aspx.

Figure 7.16 Backup Progress dialog

Figure 7.17 Scheduled backup format warning

r

estoringwith

wsB

Recovering VMs and their configurations is a simple process via the graphical user interface.

We won’t cover the process to recover the parent partition and physical host, but you can do this easily with WSB. (Often, recovery of the physical host isn’t required for a VM recovery.)

To begin the recovery of a VM, launch WSB (Start  Administrative Tools  Windows Server Backup), and select Actions  Recover. The Recovery Wizard walks you through the restore process, beginning with the selection of the recovery server (see Figure 7.18).

Typically, you’ll have multiple backup sets available from which to restore. Available backup sets are displayed with a calendar to help you choose (see Figure 7.19). Note that the most recent backup is selected by default.

Figure 7.18 Server selection

Figure 7.19 Select Backup Date dialog

Manually Backing up and RecoveRing a viRtual Machine

|

139

You can also choose the type of recovery. You can restore individual files, entire volumes, or applications using WSB. For a Hyper-V recovery, select Applications (see Figure 7.20).

Often, Hyper-V is the only application listed for recovery (see Figure 7.21), because other applications typically aren’t loaded in the parent partition.

Figure 7.20 Select Recovery Type dialog

Figure 7.21 Select Application dialog

The names (in this case, the GUID) of VMs and the Initial Store for the Hyper-V configura-tion are listed as applicaconfigura-tion components to be restored (see Figure 7.22). Note that all VMs that are part of a backup are restored; WSB can’t restore individual VMs backed up from the same volume.

You have two options for the restore location of recovered application data. You can direct the recovery of VM-related files to the original source location or to another location (see Figure 7.23).

After you select all your options, the Recovery Wizard Confirmation screen appears, and the restore proceeds (see Figure 7.24).

Figure 7.22 Application com-ponents list

Figure 7.23 Specify Recovery Options dialog

Manually Backing up and RecoveRing a viRtual Machine

|

141

Similar to the backup process, you can watch the recovery progress in the wizard (see Figure 7.25). The wizard’s progress bar shows the completion percentage for each item you selected for recovery.

Figure 7.24 Confirmation of backup and restore options

Figure 7.25 Recovery Progress dialog

The wizard also displays the final recovery status (success or failure); see Figure 7.26. In the Recovery Details, the wizard lists the total amount of data transferred.

As with the backup wizard, you can close the Recovery Wizard before recovery is complete.

You can view the status of historic backup and recovery jobs as well as other WSB-related mes-sages in the Mesmes-sages windows in the main WSB console (see Figure 7.27).

Figure 7.26 Recovery complete

Figure 7.27 WSB console with logged events

Manually Backing up and RecoveRing a viRtual Machine

|

143