IBM Spectrum Protect Cient Command Line Utility for Linux


In this article:

These instructions will allow you to perform key data backup tasks using IBM Spectrum Protect from the command line.

Getting started

Run dsmc as root from the shell prompt:

#  dsmc    <Enter>

You should see a prompt of the form:

IBM Spectrum Protect

Command Line Backup-Archive Client Interface

  Client Version 8, Release 1, Level 0.2

  Client date/time: 19-06-2017 11:19:02

(c) Copyright by IBM Corporation and other(s) 1990, 2017. All Rights Reserved.

Node Name: TEST-UBUNTU-OUCS

Session established with server OX_HFS_B1: AIX

 Server 7, Release 1, Level 6.0

 Server date/time: 19-06-2017 11:19:02  Last access: 19-06-2017 11:18:28      

Protect>

To query your scheduled backup slot enter q sched (which is short for query schedule). The output should look similar to that below:

Protect> q sched  <Enter>

    Schedule Name: WEEKLY_ITSERV

      Description: ITSERV weekly incremental backup

   Schedule Style: Classic

           Action: Incremental

          Options:

          Objects:

         Priority: 5

   Next Execution: 149 Hours and 35 Minutes

         Duration: 15 Minutes

           Period: 1 Week 

      Day of Week: Wednesday

            Month:

     Day of Month:

    Week of Month:

    Expire: Never  

Querying what partitions have been backed up

At the Protect> prompt enter q fi to list which partitions have been backed up:

Protect> q fi  <Enter>

#       Last Incr Date      Type    File Space Name

---     --------------      ----    ---------------

  1   02-05-2013 02:13:13   EXT4    /           

  2   25-07-2014 12:26:09   EXT3    /home

Top

Querying what files have been backed up

The syntax for querying what files you have backed up involves giving a file specification which is necessarily OS specific. Also, if an incorrect file specification is given it may appear that you have no backups.

Consequently, several worked examples are displayed below for Windows, Mac, Linux/Unix and Netware environments.

If you give just a path to a directory/folder you will only get the folder returned as the output:

Protect> q ba /home/ians/projects

   Size      Backup Date                Mgmt Class           A/I File

   ----      -----------                ----------           --- ----

   512  B  24-04-2012 02:52:09          STANDARD             A  /home/ians/projects 

If you just add a trailing * (star) as a wildcard in the above query, TSM will only return those files and directories backed up immediately below the directory path given in the query

Protect> q ba /home/ians/projects/*

   Size      Backup Date        Mgmt Class A/I File

   ----      -----------        ---------- --- ----

    512  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106

  1,024  08-12-2011 02:46:53    STANDARD    A  /home/ians/projects/hsm41perf

    512  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hsm41test

    512  24-04-2012 00:22:56    STANDARD    A  /home/ians/projects/hsm42upg 

If you want to query all the current files and directories backed up under a directory and all its subdirectories you need to add the -subdir=yes option as below:

Protect> q ba /home/ians/projects/* -subdir=yes

   Size      Backup Date        Mgmt Class A/I File

   ----      -----------        ---------- --- ----

    512  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106

  1,024  08-12-2011 02:46:53    STANDARD    A  /home/ians/projects/hsm41perf

    512  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hsm41test

    512  24-04-2012 00:22:56    STANDARD    A  /home/ians/projects/hsm42upg

  1,024  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106/test

  1,024  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106/test/test2

 12,048  04-12-2011 02:01:29    STANDARD    A  /home/ians/projects/hsm41perf/tables

 50,326  30-04-2012 01:35:26    STANDARD    A  /home/ians/projects/hsm42upg/PMR70023

 50,326  27-04-2012 00:28:15    STANDARD    A  /home/ians/projects/hsm42upg/PMR70099

 11,013  24-04-2012 00:22:56    STANDARD    A  /home/ians/projects/hsm42upg/md5check 

By default only the current versions of files are listed. In order to query both current active and previous inactive versions of files, add the -inactive option to the query:

Protect> q ba /home/ians/projects/* -subdir=yes   -inactive

   Size      Backup Date        Mgmt Class A/I File

  ----      -----------        ---------- --- ----

    512  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106

  1,024  08-12-2011 02:46:53    STANDARD    A  /home/ians/projects/hsm41perf

    512  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hsm41test

    512  24-04-2012 00:22:56    STANDARD    A  /home/ians/projects/hsm42upg

  1,024  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106/test

  1,024  12-09-2011 19:57:09    STANDARD    A  /home/ians/projects/hfs0106/test/test2

 12,048  04-12-2011 02:01:29    STANDARD    A  /home/ians/projects/hsm41perf/tables

  8,448  03-12-2011 01:31:18    STANDARD    I  /home/ians/projects/hsm41perf/tables

 50,326  30-04-2012 01:35:26    STANDARD    A  /home/ians/projects/hsm42upg/PMR70023

 50,326  27-04-2012 00:28:15    STANDARD    A  /home/ians/projects/hsm42upg/PMR70099

 11,013  24-04-2012 00:22:56    STANDARD    A  /home/ians/projects/hsm42upg/md5check

 11,013  23-04-2012 17:10:08    STANDARD    I  /home/ians/projects/hsm42upg/md5check 

Note how the previous versions of files are marked by an I (for Inactive) in the A/I column.

Unix and Linux users should be aware of potential confusion of how TSM stores files in nested file spaces. This can arise in the following situation:

 A user backs-up a file myconf.txt on the /usr partition in the /usr/local/etc directory. Subsequently, a new disk partition is mounted at /usr/local, or it is defined as a virtualmountpoint. Running the command:

Protect> q ba /usr/local/etc/*

will not list the myconf.txt file. This is because TSM always looks for a file in the filespace (partition) with the longest name that matches the file specification you include in the command.

In the above example, the file was not backed up under the /usr/local filespace but under the /usr filespace.

To tell TSM to look for a file in latter filespace you must specify the filespace explicitly using braces, as below:

Protect> q ba {/usr}/local/etc/*

We recommend incremental backups only; selective (full) backups cause data to be sent even if it already exists on the backup server.

By default, if the disk volume is omitted, TSM will backup those volumes specified by the Domain option in the dsm.opt options file. If Domain is set to All-Local, then to backup all local volumes enter:

Protect> incr

where incr is an abbreviation for incremental.

To incrementally back up specific file systems enter:

Protect> incr  /   /usr   /usr/local   /home    

To run an incremental by date backup , add the -incrbydate option, as in:

Protect> incr  /usr   -incrbydate

To back up entire file systems irrespective of whether files have changed since the last backup, use the selective command with a wildcard and -subdir=yes as below:

Protect> sel     /*      /usr/*     /home/*  -subdir=yes 

Top

Backing up selected files

The basic syntax for backing up selected files is similar to that for backing up disk partitions. Be aware, however, that you cannot use wildcards in directory/folder names:

Protect> incr /home/ians/projects/hsm*/* -su=yes                                                  

ANS1071E Invalid domain name entered: '/home/ians/projects/hsm*/*'

Protect> sel /home/ians/projects/hsm*/* -su=yes

Selective Backup function invoked.

ANS1081E Invalid search file specification '/home/ians/projects/hsm*/*' entered

You can, however, enter several file specifications on the command line, as below:

Protect> incr /home/ians/projects/hsm41test/*  /home/ians/projects/hsm41perf/* -subdir=yes

Top

Restoring your data

The basic syntax for restoring your data is: dsmc restore source-file destination-file. If the destination-file is omitted then TSM will restore the file(s) to their original location.

Be aware that, as with backup, you cannot use wildcards in directory/folder names. By default, TSM will restore the most current active version of a file.

Restoring selected files

Protect> restore   /home/ians/myfile.txt    /home/ians/restore/

Protect> restore  /home/ians/myfile.txt    /home/ians/restore/myoldfile.txt

Note from the first example of each restore above that in order to specify a directory as a destination, you need a trailing / (slash) at the end of the destination-filespec.

Otherwise TSM may overwrite a file of the same name. The second example demonstrates a filename in the destination-filespec.

Restores of single files cannot be restarted if interrupted. In this case you will need to restore the file afresh.

Restoring multiple files and directories

Protect> restore    /home/ians/projects/hsm41test/*  /home/ians/projects/restore/   -subdir=yes

Note that in order to restore a full directory and the contents of all its sub-directories you need the -subdir=yes option.

It is always good practice to terminate the destination-filespec with a trailing / (slash) if the element in the destination-filespec is a directory.

As this restore is wild-carded, it can be restarted if interrupted due to user input (Ctrl-C), server error or communications error. Restartable restores can be queried via q rest and will restart at the point of interruption.

Restoring entire partitions

Essentially, the syntax is the same as in 'Restoring multiple files and directories' above. However, the obvious caveats are to ensure enough space in the destination partition and to allow enough time

Protect> restore   /home/*    /tmp/restore/   -subdir=yes

Restoring old and/or deleted files

As with the GUI, TSM does not, by default, list or restore old and deleted inactive versions of files and directories. If you need to restore such a file, you need the -inactive -pick options.

The -pick option, while not strictly necessary, causes TSM to display a list of files from which to pick. Issuing a restore as below will display the following pick window:

Protect> restore   /home/ians/projects/*  /tmp/restore/  -subdir=yes   -inactive   -pick

TSM Scrollable PICK Window - Restore

     #    Backup Date/Time        File Size A/I  File

   --------------------------------------------------------------------------------------------------

   170. | 12-09-2011 19:57:09        650  B  A   /home/ians/projects/hsm41test/inclexcl.test

   171. | 12-09-2011 19:57:09       2.74 KB  A   /home/ians/projects/hsm41test/inittab.ORIG

   172. | 12-09-2011 19:57:09       2.74 KB  A   /home/ians/projects/hsm41test/inittab.TEST

   173. | 12-09-2011 19:57:09       1.13 KB  A   /home/ians/projects/hsm41test/md5.out

   174. | 30-04-2012 01:35:26        512  B  A   /home/ians/projects/hsm42125upg/PMR70023

   175. | 26-04-2012 01:02:08        512  B  I   /home/ians/projects/hsm42125upg/PMR70023

   176. | 27-04-2012 00:28:15        512  B  A   /home/ians/projects/hsm42125upg/PMR70099

   177. | 24-04-2012 19:17:34        512  B  I   /home/ians/projects/hsm42125upg/PMR70099

   178. | 24-04-2012 00:22:56       1.35 KB  A   /home/ians/projects/hsm42125upg/dsm.opt

   179. | 24-04-2012 00:22:56       4.17 KB  A   /home/ians/projects/hsm42125upg/dsm.sys

   180. | 24-04-2012 00:22:56       1.13 KB  A   /home/ians/projects/hsm42125upg/dsmmigfstab

   181. | 24-04-2012 00:22:56       7.30 KB  A   /home/ians/projects/hsm42125upg/filesystems

   182. | 24-04-2012 00:22:56       1.25 KB  A   /home/ians/projects/hsm42125upg/inclexcl

   183. | 24-04-2012 00:22:56        198  B  A   /home/ians/projects/hsm42125upg/inclexcl.dce

   184. | 24-04-2012 00:22:56        291  B  A   /home/ians/projects/hsm42125upg/inclexcl.ox_sys

   185. | 24-04-2012 00:22:56        650  B  A   /home/ians/projects/hsm42125upg/inclexcl.test

   186. | 24-04-2012 00:22:56        670  B  A   /home/ians/projects/hsm42125upg/inetd.conf

   187. | 24-04-2012 00:22:56       2.71 KB  A   /home/ians/projects/hsm42125upg/inittab

   188. | 24-04-2012 00:22:56       1.00 KB  A   /home/ians/projects/hsm42125upg/md5check

   189. | 24-04-2012 00:22:56      79.23 KB  A   /home/ians/projects/hsm42125upg/mkreport.020423.out

   190. | 24-04-2012 00:22:56       4.27 KB  A   /home/ians/projects/hsm42125upg/ssamap.020423.out

   191. | 26-04-2012 01:02:08      12.78 MB  A   /home/ians/projects/hsm42125upg/PMR70023/70023.tar

   192. | 25-04-2012 16:33:36      12.78 MB  I   /home/ians/projects/hsm42125upg/PMR70023/70023.tar

        0---------10--------20--------30--------40--------50--------60--------70--------80--------90--

<U>=Up  <D>=Down  <T>=Top  <B>=Bottom  <R#>=Right  <L#>=Left

<G#>=Goto Line #  <#>=Toggle Entry  <+>=Select All  <->=Deselect All

<#:#+>=Select A Range <#:#->=Deselect A Range  <O>=Ok  <C>=Cancel

pick>

You are now in the pick interface and can select individual files to restore via the number to the left, scroll up or down via U and D as described at the bottom of each listing of files.

Remember to issue the destination-filespec with the original restore command if you want to prevent overwriting current versions of files with older versions.

Top

Restoring your data to another machine

In certain circumstances, it may be necessary to restore some, or all, of your data onto a machine other than the original from which it was backed up.

Ideally the machine platform should be identical to that of the original machine.

Please do not attempt cross-platform restores, e.g. by trying to restore files onto a Windows machine that have previously been backed up with a non-Windows one:

using TSM for Windows to try to access backups sent by other OS platforms can cause those backups to become inaccessible from the host system.

To restore your data to another machine you will need the TSM software installed on the target machine.

Entries in dsm.sys and/or dsm.opt will need to be edited if the node that you are restoring from does not reside on the same backup server as the one that you are restoring to.

To access files from another machine you should then start the TSM client as below:

 # dsmc -virtualnodename=DEAD.MACHINE   

where DEAD.MACHINE should be substituted for the nodename of the machine to be restored. You will then be prompted for the TSM password for this machine.

 You will probably want to restore to a different destination to the original files to prevent overwriting files on the local machine, as below:

Protect>  restore    /home/*    /scratch/     -subdir=yes   

Top