Backup VM
Use the backup vm command to back up Hyper-V virtual machines.
You can back up Hyper-V guests that exist on a local disk, a SAN-attached disk, a Cluster Shared Volume (CSV), or guests that exist on a remote file server share. Remote file server shares must be on a Windows Server 2012 or later system. In addition, remote file shares must be Server Message Block (SMB) 3.0 with the File Server VSS Agent Service installed on the server.
Syntax
.-,------. V | .---vmname-+-. >>-Backup VM--+------------+--+-----------------------------------+--> | .-,-----------------------------. | | V | | '---vmname--:vhdx=--disk_location-+-' .-IFIncremental-. >-- -MODE = -+---------------+----------------------------------> '-IFFull--------' >--+----------------------+--+-----------+--+----------------------+->< '- -VMBACKUPUPDATEGUID-' '- -PREview-' '- -DETail-- --options-'
Parameters
- vmname
- Specifies the name of the virtual machine that you want to back up.
To specify multiple virtual machines, separate multiple virtual machine names with commas (vm1,VM2,Vm5), or use the
domain.vmfull option. The names are case-sensitive and must match the
capitalization that is shown on the Hyper-V host in the view.
Wildcards can be used in virtual machine names.
- vmname:vhdx=disk_location
- This parameter specifies the virtual machine hard disk (VHDX) to include in Hyper-V RCT virtual
machine backup operations on Windows Server 2016 or later
operating systems.
The vmname variable specifies the name of the VM to back up. Wildcard characters can be used to select VM names that match a pattern. An asterisk (*) matches any sequence of characters. A question mark (?) matches any single character.
The :vhdx=disk_location keyword specifies the location of the VM disk to include in the backup operation. The disk location is specified in the format "controller_type controller_number disk_location_number_inside_controller". The controller type must be "SCSI" or "IDE". For example:dsmc backup vm "vm1:VHDX=IDE 1 0"
You can obtain the disk location information in the Hyper-V Manager. In the Virtual Machines view, right-click a VM and click Settings. In the Hardware section of the Settings window, locate the IDE Controller or SCI Controller, and click Hard Drive to view the hard disk settings. The controller number and disk location are displayed in the Controller and Location fields. You can also obtain the disk location information by running the Windows PowerShell cmdlet Get-VMHardDiskDrive.
You can exclude a VM disk from backup operations by specifying the exclude operator (-) before the vhdx= keyword. For example, use -vhdx= to exclude a VM disk from the backup operation of a VM:dsmc backup vm "vm1:-VHDX=IDE 1 0:-VHDX=SCSI 0 1"
If you specify multiple VM disks to include or exclude, the vhdx= or -vhdx= keyword and associated values must be separated by colons, with no intervening space characters. For example:dsmc backup vm "*:-VHDX=IDE 1 0:-VHDX=SCSI 0 1"
If you specify multiple VM names and VM disks, the VM name and associated values must be separated by semicolons, with no intervening space characters. For example:dsmc backup vm "vm1:-VHDX=IDE 1 0:-VHDX=SCSI 0 1;vm2:-VHDX=IDE 1 0:-VHDX=SCSI 0 1"
- -MODE
- You must specify the backup mode to use when backing up a virtual machine by adding the
-mode parameter on the command line. The following modes can be specified:
- IFFull
- Incremental-forever-full mode. In this mode, a snapshot of all used blocks on a virtual machine’s disks are backed up to the server. The backup includes configuration information, and all of the disks.
- IFIncremental
- Incremental-forever-incremental. In this mode, a snapshot is created of the blocks that have changed since the last incremental forever backup operation, whether full or incremental. The backup includes configuration information, and all of the disks.
- -VMBACKUPUPDATEGUID
- This option updates the globally unique identifier
(GUID) for the virtual machine that you are backing up. This parameter
is intended for use only in the following scenario:You want to restore an already backed up virtual machine named ORION. But, before you shut down and replace the copy of ORION that is running in your production environment, you want to verify the configuration of the restored virtual machine before you use it to replace the existing ORION.
- You restore the ORION virtual machine and give it a new name: dsmc restore vm Orion -vmname=Orion2
- You update and verify the ORION2 virtual machine and determine that it is ready to replace the existing virtual machine that is named ORION.
- You power down and delete ORION.
- You rename ORION2 so it is now named ORION.
- The next time that you back up ORION, by using either an incremental-forever full, or incremental-forever-incremental backup, you add the -VMBACKUPUPDATEGUID parameter to the backup vm command. This option updates the GUID, on the IBM Spectrum Protect™ server, so the new GUID is associated with the stored backups for the ORION virtual machine. The chain of incremental backups is preserved; there is no need to delete existing backups and replace them with new backups.
- -PREView
- This parameter displays additional information about a virtual machine, including the labels of the virtual hard disks that are in the virtual machine.
- When you issue the -preview option, the backup operation does not start. You must issue the backup command without the -preview option to start the backup operation.
- You can use both the -preview option and the -detail option on the command to display information about subdisks that are included when the backup is run. A subdisk is the AVHDX file that is created when a snapshot is taken of a VHDX file.
- -DETail
- This parameter displays detailed information about a virtual machine. Use this option with -preview to view more details about the disks that are involved in the backup operation.
- When you issue the -detail option, the backup operation does not start. You must issue the backup command without the -detail option to start the backup operation.
Example commands
dsmc backup vm VM1 -mode=ifincremental
dsmc backup vm "vm2:-VHDX=IDE 1 0:-VHDX=SCSI 0 1" -mode=ifincremental
dsmc backup vm VM05 -mode=ifincremental -preview
In
the command output, the -preview parameter displays the VHDX labels in the virtual machine. When the
-detail parameter is specified with the -preview parameter, no
additional information is shown for Hyper-V RCT
backups.Backup VM command started. Total number of virtual machines to process: 1
1. VM Name: VM05
Domain Keyword: VM05
Mode: Incremental Forever - Incremental
Target Node Name: NODE14
Data Mover Node Name: NODE14
Cluster Resource: No
Disk[1]
Name: \\node14\d$\Hyper_V_Virtual_Machine\VM05\Virtual Hard Disks\VM05.vhdx
Capacity: 15.00 GB
Size: 10.91 GB
Status: included
Disk Type: VHDX
Number of Subdisk: 0
Controller Location: IDE 0 0
Disk[2]
Name: \\node14\d$\Hyper_V_Virtual_Machine\VM05\Virtual Hard Disks\VM05_Disk2.vhdx
Capacity: 2.00 GB
Size: 132.00 MB
Status: included
Disk Type: VHDX
Number of Subdisk: 0
Controller Location: SCSI 0 1
Total number of virtual machines processed: 1
dsmc backup vm VM3 -mode=ifincremental -preview
In
the command output, the -preview parameter displays the VHDX labels in the virtual machine:VM Name: VM3
Domain Keyword: all-vm
Mode: Incremental Forever - Incremental
Target Node Name: NODE1
Data Mover Node Name: NODE1
Cluster Resource: Yes
Disk[1]
Name: c:\ClusterStorage\Volume1\Hyper-V\VM3\VM3.VHDX
Capacity: 40.00 GB
Size: 9.09 GB
Full Backup: included
Incremental Backup: excluded
Disk Type: VHDX
Number of Subdisk: 1
Disk[2]
Name: c:\ClusterStorage\Volume3\Hyper-V\VM3\VM3-DISK2.VHDX
Capacity: 127.00 GB
Size: 4.00 MB
Full Backup: included
Incremental Backup: excluded
Disk Type: VHDX
Number of Subdisk: 1
When
the -detail parameter is specified with the -preview parameter,
the VHDX labels and their subdisks are shown. The following example output is abbreviated to show
only information about one virtual machine and one
disk:VM Name: VM3
Domain Keyword: all-vm
Mode: Incremental Forever - Incremental
Target Node Name: NODE1
Data Mover Node Name: NODE1
Cluster Resource: Yes
Disk[1]
Name: c:\ClusterStorage\Volume1\Hyper-V\VM3\VM3.VHDX
Capacity: 40.00 GB
Size: 9.09 GB
Full Backup: included
Incremental Backup: excluded
Disk Type: VHDX
Number of Subdisk: 1
Subdisk[1]
Name: c:\ClusterStorage\Volume1\Hyper-V\VM3\VM3_9B26166-9C3E.avhdx
Capacity: 40.00 GB
Size: 1.25 GB
Full Backup: included
Incremental Backup: included
Disk Type: AVHDX
Options file examples
In the following examples, the domain.vmfull option is used to process specific virtual machines.
domain.vmfull VM04,VM05
The following command
shows a preview of a Hyper-V RCT backup of all virtual machines specified in the
domain.vmfull option. The command displays preview information about each virtual machine:
dsmc backup vm -mode=iffull -preview
The
following output is
shown:Backup VM command started. Total number of virtual machines to process: 2
1. VM Name: VM04
Domain Keyword: VM04
Mode: Incremental Forever - Full
Target Node Name: NODE14
Data Mover Node Name: NODE14
Cluster Resource: No
Disk[1]
Name: \\node14\d$\Hyper_V_Virtual_Machine\VM04\Virtual Hard Disks\VM04.vhdx
Capacity: 36.00 GB
Size: 9.16 GB
Status: included
Disk Type: VHDX
Number of Subdisk: 0
Controller Location: IDE 0 0
2. VM Name: VM05
Domain Keyword: VM05
Mode: Incremental Forever - Full
Target Node Name: NODE14
Data Mover Node Name: NODE14
Cluster Resource: No
Disk[1]
Name: \\node14\d$\Hyper_V_Virtual_Machine\VM05\Virtual Hard Disks\VM05.vhdx
Capacity: 15.00 GB
Size: 10.91 GB
Status: included
Disk Type: VHDX
Number of Subdisk: 0
Controller Location: IDE 0 0
Disk[2]
Name: \\node14\d$\Hyper_V_Virtual_Machine\VM05\Virtual Hard Disks\VM05_Disk2.vhdx
Capacity: 2.00 GB
Size: 132.00 MB
Status: included
Disk Type: VHDX
Number of Subdisk: 0
Controller Location: SCSI 0 1
Total number of virtual machines processed: 2
domain.vmfull BigVM,myGentoox64,HPV2VM3-OLD,Local10
The following command
shows a preview of an incremental-forever incremental backup operation of all Hyper-V virtual machines specified in the
domain.vmfull option. The command displays preview information about each virtual machine:
dsmc backup vm -mode=iffull -preview
The
following output is
shown:1. VM Name: BigVM
Domain Keyword: all-vm
Mode: Incremental Forever - Full
Target Node Name: MSF
Data Mover Node Name: MSF
Cluster Resource: No
Disk[1]
Name: \\lingonberry\c$\Users\michael\Documents\Storage\BigVM.vhdx
Capacity: 5.85 TB
Size: 5.00 MB
Full Backup: included
Incremental Backup: excluded
Disk Type: VHDX
Number of Subdisk: 0
2. VM Name: Gentoox64
Domain Keyword: all-vm
Mode: Incremental Forever - Full
Target Node Name: MSF
Data Mover Node Name: MSF
Cluster Resource: No
3. VM Name: HPV2VM3-OLD
Domain Keyword: all-vm
Mode: Incremental Forever - Full
Target Node Name: MSF
Data Mover Node Name: MSF
Cluster Resource: No
4. VM Name: Local10
Domain Keyword: all-vm
Mode: Incremental Forever - Full
Target Node Name: MSF
Data Mover Node Name: MSF
Cluster Resource: No
Disk[1]
Name: \\lingonberry\c$\Users\michael\Documents\Storage\Local10.vhdx
Capacity: 127.00 GB
Size: 4.00 MB
Full Backup: included
Incremental Backup: excluded
Disk Type: VHDX
Number of Subdisk: 0
Total number of virtual machines processed: 4
ANS1900I Return code is 0.
ANS1901I Highest return code was 0.
- Related links for backing up Hyper-V virtual machines