Data recovering using the command line tool
Table of contents
- Instructions for starting the command line tool
- Data recovering using the command line tool
- Recovery Examples
- 1.) Recover a single file from a selection of existin versions
- 2.) How to find a directory from a backup at a specific time and recover it to a new directory
- 3.) Restoring a directory with subdirectories, in which some files have been deleted (without overwriting the rest of the files)
- 4.) Restore different or all versions of a file
- 5.) Recover files / folders that were saved during a specific period of time
- 6.)Restoring files and folders with the help of file lists
- 7.) Restore data on another Computer (directed recover)
Instructions for starting the command line tool
Linux root@myPC~$ dsmc Then you will see the tsm-Prompt tsm> Here further commands (explained later) can be used. |
Windows This call is described here: "Configuration - Windows". Or you may open a Command Prompt window. There you can change the directory and start "dsmc" by: C:> cd C:\Program Files\Tivoli\TSM\baclient C:\Program Files\Tivoli\TSM\baclient> dsmc.exe |
Data recovering using the command line tool
The following examples are a selection of the most common uses. Except for the different spellings of directories under Linux (e.g. /home/mueller/Dokumente/) and Windows (z.B: C:\\Programme\Tivoli\) there are no differences. You need the requirements described under "Recovery of data".
Recovery Examples
You need the requirements described under "Recovery of data".
1.) Recover a single file from a selection of existin versions
tsm> restore /etc/host -pick -inactive /tmp/restored/ |
Meaning: |
Restoring the data /etc/hosts into a new target directory "/tmp/restored/" by manually selecting (-pick) specific versions. Using the indicator "-inactive" is necessary to retrieve already deleted or modified versions of the file. |
Next, an indicator should be given. The column A/I means: A = last valid version (active) I = inactive versions that are no longer on the productive disk |
Select the required version from by entering the respective number. In the example, the older of the two versions will be restored. |
tsm> restore /etc/host -pick -inactive /tmp/restored/ Restore function invoked. TSM Scrollable PICK Window - Restore # Backup Date/Time File Size A/I File ---------------------------------------------------------------------------------------- 1. | 12/05/08 13:18:21 1.69 KB A /etc/hosts 2. | 11/21/08 10:16:19 726 B I /etc/hosts | 0---------10--------20--------30--------40--------50--------60--------70--------80------ <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> 2 |
In the next example, the older of the two files appears as marked with "x". You can continue the recovery by typing "o".
# Backup Date/Time File Size A/I File
|
You will receive the following message. You may close the TSM prompt with "quit" after the recovery is finished.
Restoring 726 /etc/hosts --> /tmp/hosts [Done] Restore processing finished. Total number of objects restored: 1 Total number of objects failed: 0 Total number of bytes transferred: 750 B Data transfer time: 0.00 sec Network data transfer rate: 104,631.69 KB/sec Aggregate data transfer rate: 0.00 KB/sec Elapsed processing time: 00:03:09 tsm> quit |
2.) How to find a directory from a backup at a specific time and recover it to a new directory
tsm> rest /home/otto/ -sub=yes -inactive -pitd=10/20/14 /home_neu/otto_neu/ |
Restoring the complete directory "/home/otto/" including all subdirectories as it was on the 20th October 2014, to the new directory "/home_neu/otto_neu/" (new directory must be created beforehand). There are no further commands, so the recovery starts immediately.
3.) Restoring a directory with subdirectories, in which some files have been deleted (without overwriting the rest of the files)
The following is the recovery process with Windows. The TSM syntax does not differ from the syntax on Linux.
In the folder "D:\zwtest\update_test\", files were accidentally deleted. They need to be restored without overwriting the existing files from the most recent backup.
tsm> restore -sub=yes -replace=no D:\zwtest\update_test\ |
The example shown above relates to exacty one file: update_problem.txt, all other files exist already and are not restored, but omitted (skipping) . |
subdir=yes mens that the folder is handled recursively, including all subfolders and their contents. |
replace=no means existing files are not overwritten. |
4.) Restore different or all versions of a file
Initially, you will be asked which versions exist:
tsm> q backup -inactive -subdir=yes /home/testuser/xxxx.txt Size Backup Date Mgmt Class A/I File |
There are 3 versions of the file "xxxx.txt" whose backup date and time is shown. You are able to retrieve each individual version and change the name of the file when necessary.
For example:
tsm> restore -inactive -subdir=yes -pitd=10/17/2014 /home/testuser/xxxx.txt /restoreverzeichnis/xxxx_vom17oct2014.txt |
5.) Recover files / folders that were saved during a specific period of time
It must first be determined exactly which files and folders are concerned. The output can take a very long time, so the output can also be written as a file, for example "/tmp/Ausgabedatei.txt". Start the following command from the command line, or from the Windows command prompt window:
root@myPC~$ dsmc q backup -inact -subd=yes \ -fromdate=09/30/2014 -todate=10/10/2014 \ /home/nutzer/ >> /tmp/Ausgabedatei.txt |
The content of the file /tmp/Ausgabedatei.txt is:
IBM Tivoli Storage Manager
|
You can now restore the individual files from /tmp/Ausgabedatei.txt as described in example 4.
If you need to restore a very large number of files, use the file /tmp/Ausgabedatei.txt for creating a script "restore_something.sh", which can be processed at the end. This saves a lot of legwork. The script "restore_something.sh" could look something like this:
#!/bin/sh dsmc restore -inactive -pitd=10/08/2014 home/nutzer/status.txt /restoreverzeichnis/ dsmc restore -inactive -pitd=10/05/2014 /home/nutzer/w64/README.txt /restoreverzeichnis/ dsmc restore -inactive -pitd=10/05/2014 /home/nutzer/w64/WinX64-README.ftp /restoreverzeichnis/ dsmc restore -inactive -pitd=10/05/2014 /home/nutzer/w64/WinX64.exe /restoreverzeichnis/ dsmc restore -inactive -pitd=10/05/2014 /home/nutzer/w64/DWinX64.exe /restoreverzeichnis/ |
The script is executable and executed from the command line. No further entries are required.
root@myPC~$ chmod u+x restore_something.sh |
6.)Restoring files and folders with the help of file lists
Unlike the previous example, now the desired file/filder names of recent backups are known. For example, there is a list of recoverable files/folders "Dateiliste.txt" created in /tmp. Their content might look like:
/home/nutzer/Unterordner1/ /home/nutzer/Unterordner2/ |
The restoration command is:
root@myPC~$ dsmc restore -subdir=yes -filelist=/tmp/Dateiliste.txt /verzeichnis/ |
Thereby the subfoldoers of "home/nutzer" are at first restored into "/verzeichnis" (as stated in "Dateiliste.txt"). Their content is restored in every corresponding subfolder.
Optionally, instead of a file list, one can enter data individually like in the following example:
/home/nutzer/Unterordner1/datei_aus Unterodner1.txt |
Using the above-mentioned command, all files (without any subfolder structure) are restored in the destination directory.
root@myPC~$ ls /verzeichnis/ datei_aus Unterodner1.txt datei_aus Unterodner2.txt datei_aus Unterodner3.txt |
7.) Restore data on another Computer (directed recover)
In the case where your computer is infected with an unrecoverable error, it may be necessary to restore the data to another computer. It is best to find a computer already suited with TSM backup running on a different node name.
Windows: Create a file in the path C:\Programme\Tivoli\TSM\baclient. Name of the file, e.g.: dsm_restore_old.opt Content of this file are the TSM configuration data of your broken computer. Then give from a Windows command promt window the following commands: |
cd "C:\Program Files\Tivoli\TSM\baclient dsmc -optfile=dsm_restore_old.opt |
See the previous example for further instructions. |
Linux: Create a file in the path /opt/tivoli/tsm/client/ba/bin. Name of the file, e.g.: dsm_restore_old.opt. This file contains only the line "Servername server_b". Attach the file /opt/tivoli/tsm/client/ba/bin/dsm.sys, the entry "Servername server_b", and include the relevant lines from the old dsm.sys (whithout the first line of "server name..."). |
root@myPC~$ dsmc -optfile=/opt/tivoli/tsm/client/ba/bin/dsm_restore_old.opt |
Further instructions are found in the previous example. |