Selective Restore on CommandLine

From SEPsesam
Jump to: navigation, search

How to do a selective restore from an unknown tape on command line

Load/Insert the Tape into the Tape Drive

Be sure the right tape is inserted into the tape drive. If you have a loader device, load the desired tape to the drive using a loader command.

Source the SEP sesam Profile

See:

How to set a SEP sesam profile?

List the Backups on the tape

After the tape has been inserted list all the backups on the tape drive. This can be done with the command:

sm_sms_interface dir -d <TAPE_DRIVE>
 In this example the first non rewinding tape drive on Linux:
sm_sms_interface dir -d /dev/nst0

The output will look like this:

Sms4.jpg

Important information here:
1) Segment number (4)
2) Saveset name (SC20090610105624)
3) Tape Label (cefix00001) 
4) Tape ID (1)

Doing a full restore of the Savesets

Restore.jpg Restore suc.jpg

The restore is done with the sbc command which contains the following information:

sbc -r -l FULL -C <client_host>:11001 -S <server_host>:11001 -d SMS:<tape_device> -t <tape_label>:<tape_id> -s <saveset_id> -n <segment number> -R /my_restore_target

Doing a Selective Restore of Savesets

Re-Create the SEP sesam listing files using "sm_arch"

The next step is recreating the SEP sesam listing files from the tape. This is done using the sm_arch command:

sm_arch restore_journal -d <DRIVE> -m <MEDIA_POOL> -t <TAPE_LABEL> -T <TAPE_TYPE> -s <SAVESET_ID>

Using the values from our example above, the command looks like this: (NOTE: Enter the entire saveset ID, including the characters after the @ sign if existing)

sm_arch restore_journal -d 1 -m cefix -t cefix00001 -T LTO -s SC20090610105624

In more recent versions SEP sesam uses an extended saveset id. In this case the command would look like this:

sm_arch restore_journal -d 1 -m cefix -t cefix00001 -T LTO -s SC20090610105624@gft456Sd

After the journal has been restored the new .lis file can be found in:

<SESAM_INSTALL_DIR>/var/lis/

Creating a selective list of files

In order to tell the SEP sesam backup client to do a selective restore of certain files, a selective file list has to be created.

In order to do this, grep the just created sesam ".lis" file for the file names and write them to a file called like the save-set with ending ".sel", like:

grep my_desired_file_to_restore <SESAM_INSTAL_DIR>/var/lis/<lis_file_just_generated_with_sm_arch>.lis

Write the output of this command complete line to a file called

<SAVESET_ID>.sel

like in our example:

SC20090610105624.sel

Copy this file to

<SESAM_INSTALL_DIR>/var/work/smslis/SC20090610105624.sel

Start the restore from the command line with mode selective

The restore can then be started with:

sbc -r -l sel -C <client_host>:11001 -S <server_host>:11001 -d SMS:<tape_device> -t <tape_label>:<tape_id> -s <saveset_id> -n <segmentnumber> -R /my_restore_target

It will look for a file in the <SESAM_INSTALL_DIR>/var/work/smslis/ directory which contains the name of the Saveset ID and then only restore the file listed in this selective file.