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
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.
Restriction: Do not use the word "aggregate" as a VM name. The word "aggregate" is reserved for the VM name field in an IBM Spectrum Protect message. Messages that contain the word "aggregate" as the VM name show statistics that represent the total value of all VM guests that are backed up per data mover. - vmname:vhdx=disk_location
- This parameter specifies the virtual machine hard disk (VHDX) to include in Hyper-V virtual machine backup operations.
- -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. This value is the default.
- -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.
- You restore the ORION virtual machine and give it a new name:
- -PREView
- This parameter displays additional information about a virtual machine, including the labels of the virtual hard disks that are in the virtual machine.
- -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.
Return codes for virtual machine backup operations
Backup operations for virtual machines can complete with the return codes that are shown in the
following table.
Return code | Description |
---|---|
0 | A command to back up one or more virtual machines completed successfully. |
8 | A command to back up multiple virtual machines succeeded for only some of the virtual machines that were targeted by the command. Examine the log file to determine the processing status for each of the targeted virtual machines. |
12 | Indicates that either of the following error conditions occurred:
|
Tip about the final statistics: If you are running
multiple backup sessions, the value that is displayed in the Data transfer
time field in the final statistics can be higher than the value in the
Elapsed processing time field. The data transfer time is the sum of the times
that each backup takes to send data across the network. This number does not include the time for
the data mover to read the data from disk before sending it, nor the time to wait for server
transactions to complete. This number can be greater than the elapsed processing time if the
operation uses multiple concurrent sessions to move data, such as multi-session backup operations.
This value includes the time that it takes to send data more than once due to retries, such as when
a file changes during a backup operation.
Example commands
-
The following command starts an incremental-forever incremental backup of a Hyper-V virtual machine that is named "VM1":
dsmc backup vm VM1 -mode=ifincremental
-
For Windows Server 2016 or later operating systems: The following command excludes an IDE disk (with controller number 1 and disk location 0) and a SCSI disk (with controller number 0 and disk location 1) from an incremental-forever incremental RCT backup of a virtual machine, "vm2":
dsmc backup vm "vm2:-VHDX=IDE 1 0:-VHDX=SCSI 0 1" -mode=ifincremental
-
For Windows Server 2016 or later operating systems: The following command shows the preview of an incremental-forever incremental RCT backup of a virtual machine, "VM05":
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.dsmc backup vm VM05 -mode=ifincremental -preview
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
-
For Windows Server 2012 or 2012 R2: The following command starts an incremental forever-incremental backup of a Hyper-V virtual machine, "VM03":
In the command output, the -preview parameter displays the VHDX labels in the virtual machine:dsmc backup vm VM03 -mode=ifincremental -preview
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:1. VM Name: VM03 Domain Keyword: all-vm Mode: Incremental Forever - Incremental Target Node Name: NODE14_HV_DM Data Mover Node Name: NODE14_HV_DM Cluster Resource: No Disk[1] Name: \\NODE14\d$\Hyper-V\VM03\VM03\Virtual Hard Disks\VM03.vhdx Capacity: 64.00 GB Size: 28.91 GB Status: excluded Disk Type: VHDX Number of Subdisk: 1
1. VM Name: VM03 Domain Keyword: all-vm Mode: Incremental Forever - Incremental Target Node Name: NODE14_HV_DM Data Mover Node Name: NODE14_HV_DM Cluster Resource: No Disk[1] Name: \\NODE14\d$\Hyper-V\VM03\VM03\Virtual Hard Disks\VM03.vhdx Capacity: 64.00 GB Size: 28.91 GB Status: excluded Disk Type: VHDX Number of Subdisk: 1 Subdisk[1] Name: \\NODE14\d$\Hyper-V\VM03\VM03\Virtual Hard Disks\ VM03_94F6257B-5C61-45F1-BD62-3323DCF26954.avhdx Capacity: 64.00 GB Size: 180.00 MB Status: excluded Disk Type: AVHDX
Options file examples
The
domain.vmfull option is used to process specific virtual machines. In the following example,
the domain.vmfull option is specified as
follows:
domain.vmfull VM04,VM05
The following command shows a preview of a
full backup of virtual machines specified by the
domain.vmfull option. The command displays preview information about each virtual machine:
dsmc backup vm -mode=iffull -preview
The
following output is shown on Windows Server 2016 and later
operating
systems: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
The following output is shown on Windows Server 2012 and 2012
R2:
Backup VM command started. Total number of virtual machines to process: 2
1. VM Name: VM04
Domain Keyword: all-vm
Mode: Incremental Forever - Incremental
Target Node Name: NODE14_HV_DM
Data Mover Node Name: NODE14_HV_DM
Cluster Resource: No
Disk[1]
Name: \\NODE14\d$\Hyper-V\VM04\VM04\Virtual Hard Disks\VM04.vhdx
Capacity: 64.00 GB
Size: 28.91 GB
Status: excluded
Disk Type: VHDX
Number of Subdisk: 1
Subdisk[1]
Name: \\NODE14\d$\Hyper-V\VM04\VM04\Virtual Hard Disks\
VM04_94F6257B-5C61-45F1-BD62-3323DCF26954.avhdx
Capacity: 64.00 GB
Size: 180.00 MB
Status: excluded
Disk Type: AVHDX
2. VM Name: VM05
Domain Keyword: all-vm
Mode: Incremental Forever - Incremental
Target Node Name: NODE14_HV_DM
Data Mover Node Name: NODE14_HV_DM
Cluster Resource: No
Disk[1]
Name: \\NODE14\d$\Hyper-V\disks\Windows 10.vhdx
Capacity: 20.00 GB
Size: 18.75 GB
Status: excluded
Disk Type: VHDX
Number of Subdisk: 1
Subdisk[1]
Name: \\NODE14\d$\Hyper-V\disks\
Windows 10_15F8A5AA-C104-4C74-8F68-B57B27592F8A.avhdx
Capacity: 20.00 GB
Size: 112.00 MB
Status: excluded
Disk Type: AVHDX
Disk[2]
Name: \\NODE14\e$\Hyper-V\disks\Windows10_disk2\Windows10_disk2.vhdx
Capacity: 5.00 GB
Size: 5.00 GB
Status: excluded
Disk Type: VHDX
Number of Subdisk: 1
Subdisk[1]
Name: \\NODE14\e$\Hyper-V\disks\Windows10_disk2\
Windows10_disk2_15F8A5AA-C104-4C74-8F68-B57B27592F8A.avhdx
Capacity: 5.00 GB
Size: 4.00 MB
Status: excluded
Disk Type: AVHDX
Disk[3]
Name: \\NODE14\e$\Hyper-V\disks\Windows10_disk2\Windows10_disk5.vhdx
Capacity: 1.00 GB
Size: 1.00 GB
Status: included
Disk Type: VHDX
Number of Subdisk: 1
Subdisk[1]
Name: \\NODE14\e$\Hyper-V\disks\Windows10_disk2\
Windows10_disk5_15F8A5AA-C104-4C74-8F68-B57B27592F8A.avhdx
Capacity: 1.00 GB
Size: 4.00 MB
Status: included
Disk Type: AVHDX
Total number of virtual machines processed: 2
ANS1900I Return code is 0.
ANS1901I Highest return code was 0.