AFS restore guide
How to restore files and volumes with the text client. This describes how to restore AFS backups from TSM (ADSM)
A short who is who
- bigblue.pdc.kth.se
 - c-name pointing on where the TSM server is running (machine goby).
 - BIGBLUE.PDC.KTH.SE
 - TSM servers' internal name
 - AFSBACKUP.STACKEN.KTH.SE
 - TSM client's name for making its own and AFS backups.
 - goby.pdc.kth.se
 - hostname of the backup server
 
THINK before following this like a SLAVE
Step 0: Find your backup server, authenticate and set env vars
$ rxtelnet -l root mustard mustard# kauth your-uname.admin bash Password: mustard# export DSM_CONFIG=/opt/tivoli/tsm/client/ba/bin/dsm-afsbackup.opt mustard# cd /scratch
Step 1: Locate the volume to restore
If you want to restore a lost volume, there is not much to do here, skip to next step.
If you want to restore a file, use the AFS command fs
      examine to determine which volume the missing file(s)
      should be restored from. Example:
$ fs exa ~haba/
Volume status for vid = 536875292 named home.haba
Current disk quota is 300000
Current blocks used are 253452
The partition has 3776350 blocks available out of 8781824
    Step 2: Locate and copy the most suitable backup files
All backups reside in PDC's TSM system. Backups are stored and named by volume. There are two types of backup files, full and incremenal backups. Backup files are named:
volume_name.backup.date_of_last_backup.date_of_backup
      
      Full backups are the files with date_of_last_backup set to 00000000 (no previous date of backup).
Use /opt/tivoli/tsm/client/ba/bin/dsmc query
      archive to find the volume dump you want.
mustard# /opt/tivoli/tsm/client/ba/bin/dsmc query archive '/scratch/home.haba.backup*'
Tivoli Storage Manager
Command Line Backup/Archive Client Interface - Version 5, Release 1, Level 1.0  
(C) Copyright IBM Corporation 1990, 2002 All Rights Reserved.
Node Name: AFSBACKUP.STACKEN.KTH.SE
Session established with server BIGBLUE: AIX-RS/6000
  Server Version 4, Release 2, Level 2.6
  Server date/time: 12/08/02   15:09:18  Last access: 12/08/02   15:09:10
             Size  Archive Date - Time    File - Expires on - Description
             ----  -------------------    -------------------------------
    70,593,111  B  11/02/02   16:23:40    /scratch/home.haba.backup.00000000.20021102 Never AFS Backup 20021102
    70,593,111  B  11/19/02   16:12:24    /scratch/home.haba.backup.00000000.20021119 Never AFS Backup 20021119
    70,593,111  B  11/28/02   16:01:29    /scratch/home.haba.backup.00000000.20021128 Never AFS Backup 20021128
    70,652,254  B  12/02/02   19:51:38    /scratch/home.haba.backup.00000000.20021202 Never AFS Backup 20021202
     1,273,979  B  11/30/02   12:42:48    /scratch/home.haba.backup.20021128.20021130 Never AFS Backup 20021130
     1,172,318  B  12/06/02   09:34:34    /scratch/home.haba.backup.20021202.20021206 Never AFS Backup 20021206
     
      The dsmc client is far too stupid to know regexps. You can only use * as wildcard on filenames. Different backups may have different descriptions. Do not care about that, the filenames contain all information.
Step 3: Retrieve the right volume dump(s) from TSM
This may take time because it involves tape mounting and cueing.
mustard# /opt/tivoli/tsm/client/ba/bin/dsmc retrieve /scratch/home.haba.backup.00000000.20000731 (...) mustard# /opt/tivoli/tsm/client/ba/bin/dsmc retrieve /scratch/home.haba.backup.20000731.20000914 (...)
The date 20000731 shows the dependency between zero and incremental backup.
Step 4: Restore data to AFS from the backup file(s)
First of all, locate a server and partition where a new volume can be created.
To restore a full volume, do the following:
kauth me.adminvos restore server partition volume_name -file /scratch/name_of_full_backup_file -overwrite full -verbose- If you also have an incremental backup file, do
vos restore server partition volume_name -file /scratch/name_of_incremental_backup_file -overwrite incremental -verbose - Verify that the volume is available in the AFS file space
 - Remove the volume backup files:
	
rm /scratch/volume_backup_files* 
To restore a file, do the following:
- choose a temporary and nonexistent volume_name, such as misc.tmp_delete_me
 -  If you have a full backup file, do
vos restore server partition volume_name -file /scratch/name_of_full_backup_file -overwrite full -verbose -  If you also have an incremental backup file, do
vos restore server partition volume_name -file /scratch/name_of_incremental_backup_file -overwrite incremental -verbose -  Mount the new volume somewhere in the AFS file space
	(your home dir maybe) using the 
fs mkmount path volumecommand. - Change dir to the path where you mounted the missning volume and copy the file(s) you want to restore to their original location
 -  Remove the temporary volume using the following commands:
	
cd / fs rmmount path vos remove server partition volume_name rm /tmp/volume_backup_files*
 
Example:
mustard# vos restore hamburger a misc.foo_jonase -file /scratch/home.jonase.backup.19961122.19961126 -overwrite incremental -verbose -localauth chicken$ fs mkmount /afs/.pdc.kth.se/misc/foo_jonase misc.foo_jonase chicken$ cd /afs/.pdc.kth.se/misc/foo_jonase chicken$ cp .xinitrc ~jonase chicken$ cd / chicken$ fs rmmount /afs/.pdc.kth.se/misc/foo_jonase mustard# vos remove hamburger a misc.foo_jonase -verbose -localauth mustard# rm /scratch/home.pdc.jonase.backup.19961122.19961126