Restoring virtual disks using a CSV file

To specify different options for parallel restore operations, you can use a CSV file.

Before you begin

Command-line restore provides a wide range of options that are applied simultaneously to a number of virtual machines. This works well for a large number of machines using the same settings, but it does not provide flexibility in supporting parallel restore operations with different settings.

As an alternative to the command-line syntax, you can use a comma separated values (CSV) file to define the list of virtual machines to restore, using a subset of the available options (-vmname, -datastore, -datacenter, -host, -pitdate, and -pittime). Using a CSV file provides more granularity than pure command-line syntax and can deal with more complex situations.

CSV files can be output from standard spreadsheet applications, providing ease-of-use and avoiding complex command line syntax. You can add one or more columns to store notes and observations: only the column headings defined below will be recognized and acted on. In some versions of vSphere Web client you can generate a CSV file from any list view. In the Inventory List, you can use the Export List functionality to create a CSV report listing all VMs in a host cluster. This output can provide a starting point for the CSV file you use to drive bulk restore operations.

Each row in the CSV after the header row represents a virtual machine to be restored. Unlike pure command-line parallel restore, each virtual machine may take a different set of options. You can specify a mix of active and inactive backups in the same restore operation. The following column heading names are recognized by the command.
Table 1. Column heading names
Heading Description Usage
Virtual Machine Name The name of the virtual machine to be restored. No wildcard characters are allowed. Case-sensitive. This column is mandatory.
New Virtual Machine Name The name of the virtual machine that is restored. This column uses the same syntax as the -vmname option. Optional. You can leave this column blank if you want to reuse the existing name.
New Datastore The new datastore to which the virtual hard disks are restored. This column uses the same syntax as the -datastore option. Optional. You can leave this column blank if you want to reuse the existing datastore.
New Datacenter The new datacenter with which the virtual machine should be associated. Uses the same syntax as the -datacenter option. Optional. You can leave this column blank if you want to reuse the existing datacenter.
New Host The new host to which the virtual machine will be restored. This column uses the same syntax as the -host option. Optional. You can leave this column blank if you want to reuse the existing host.
PITDATE The point-in-time date from which the backup is specified. This column uses the same syntax as the -pitdate option. Optional. You can leave this column blank to indicate the active backup should be restored. This column is required if PITTIME is specified in the CSV file. PITDATE dates should use the format set by the DATEFORMAT option. The default varies by locale in Windows. The default is DATEFORMAT 1 in Linux.
PITTIME The point-in-time time of day from which the backup is specified. This column uses the same syntax as the -pittime option. Optional. You can leave this column blank to indicate you want to use the active backup or if only the PITDATE is specified. PITTIME times should use the format set by TIMEFORMAT option. The default varies by locale in Windows. The default is TIMEFORMAT 1 in Linux.

Example CSVs:

This is an example of how a CSV file looks when open in a spreadsheet view:

Virtual Machine Name  New Virtual Machine Name  New Host              New Datastore     New Datacenter,     NOTES1   NOTES2  PITDATE   PITTIME
VM1                              *-DR_restore                         esx4.ibm.com       DS_8                    DC_RecoverSite1   group1      
VM2                              *-DR_restore                         esx4.ibm.com       DS_8                    DC_RecoverSite1   group1
VM3                              *-DR_restore                         esx4.ibm.com       DS_8                    DC_RecoverSite1   group1
VM4                              *-DR_restore                         esx5.ibm.com       DS_10                  DC_RecoverSite1   group2
VM5                              *-DR_restore                         esx5.ibm.com       DS_10                  DC_RecoverSite1   group2
Note: The asterisk, *, denotes reuse of the original VM name as part of a wild-card construct for a restored VM.
Note: Other command line conventions are also observed:
  • <date> is replaced by the date of the restore.
  • <time> is replaced by the time of the restore.
  • <timestamp> is replaced by a combination of <date> and <time> outputs.

This is an example of a CSV file exported to a comma-separated text file.

Virtual Machine Name,New Virtual Machine Name,New Host,New Datastore,New Datacenter,NOTES1,NOTES2,PITDATE,PITTIME
Tiny Linux VM,Tiny Linux VM -restore,,,,,,,
lucasTestVM10,* -restore,,,,,,10/03/2017,10:35 AM
big-cet-4TB,,devesx06.storage.tucson.ibm.com,,,,10/05/207,,

This CSV will restore three virtual machines with a different set of options for each virtual machine. The columns NOTES1 and NOTES2 are ignored.

Procedure

  1. Start a command-line session:
    • Windows operating systemsOpen a command prompt and change to the directory: cd "C:\Program Files\IBM\StorageProtect\baclient".
    • Linux operating systemsOpen a terminal window and change to the directory: cd /opt/tivoli/tsm/client/ba/bin.
  2. Restoring from a CSV file uses the following syntax:
    restore vm C:\restore-virtual-machines-list.csv -csv