Restoring from a Sysback Backup with Low Level Commands


Contents

About this document
    Related documentation
Instructions for Sysback version 3
Instructions for Sysback version 4
Determining the block size
Differences between Sysback versions 3 and 4

About this document

This document describes how to restore individual files and directories from a Sysback backup using specific low level commands. Although these commands are intended for use in normal mode, with the appropriate tape device manipulation commands, you can use these steps in service mode to restore data. Normally these commands would only be used in an emergency, such as when the normal Sysback commands are not restoring the data successfully or when restoring in service mode.

This method will function at AIX 3.2.5 and above with Sysback versions 3 and 4.

NOTE: This method does NOT replace the full functionality of restoring data. Use normal Sysback methods and procedures to restore an entire system. This method is only for recovering individual files when the user is unable to restore files normally with Sysback either through the Sysback commands on command line or through SMIT, or as directed by the AIX Support Center. Note also that replacing operating system specific files and/or directories in this manner is not necessarily a supported method of recovering from a disaster and system stability may be compromised. So, in many cases it is advised to recover rootvg using normal methods.

All example commands will use generic device names such as rmt0. The exact device name to use will vary depending on the system. A list of devices on the system may be found with the following command:

     lsdev -C | more

For clarification on the differences between Sysback versions 3 and 4, see the section Differences between Sysback versions 3 and 4.

Related documentation

The product documentation library is also available:
http://www.rs6000.ibm.com/resource/aix_resource/Pubs/index.html


Instructions for Sysback version 3

  1. Follow the instructions below in the section entitled Determining the block size but return to this section when complete.

  2. Before restoring, you must change the working directory to the appropriate location to restore files to. If you need to restore the file/directory to its original location, enter the following command:
         cd /
    
  3. If you need to restore to a different destination other than the original location, change the directory to the desired location.

  4. Rewind the tape drive, enter:
         tctl -f /dev/rmt0 rewind
    
  5. Fast forward the tape drive to the Sysback header on the tape for rootvg, enter:
         tctl -f /dev/rmt0.1 fsf 4
    
  6. View the header information and check to see if the Packed field has a value of Y or N, enter:
         sbread -H rmt0.1
    
    -----------| Example Header |------------
    Date:          Thu Jun 29 08:26:54 2000
    User:          root
    Host:          mars
    Type:          Volume Group
    Data:          rootvg
    Size:          688 megabytes
    Packed:        N
    Buffer:        256 Kbytes
    Volume:        1
    -----------| End Example |---------------
    
  7. Rewind the tape drive again, enter:
         tctl -f /dev/rmt0 rewind
    
  8. Fast forward the tape drive to the correct image to restore data from. This list of images on the tape will vary depending on what volume groups were included on the backup, but with Sysback version 3 (unlike Sysback version 4), each image on the tape consists of a single volume group backup. Thus, after the boot image, the install image, dummy image, and Sysback program install image, the next image would be rootvg, and any subsequent images on tape would consist of each of the nonrootvg volume groups that were included on the backup, should they exist. Note that another difference between Sysback version 3 and 4 is that Sysback version 3 only has four images on tape before rootvg's image, but Sysback version 4 has five images before the first image in rootvg.

    To restore any data from the rootvg volume group on the Sysback tape, enter the following command to forward the tape to the correct position:

         tctl -f /dev/rmt0.1 fsf 4
    

    The preceding command will position the tape so that it is positioned before the rootvg volume group image, which is actually the fifth image on the tape. All rootvg filesystems are included in this image, and the other volume groups' images would follow.

  9. Now the restore can be started. The ./<path> designation in the command will need to be replaced by the full path to the file or directory to be restored:

    NOTE: You must include the filesystem mount point in the path. This is different from Sysback version 4.

    If the Packed flag's value is N, use one of the following commands depending on the type of data being restored:

    sbread -x rmt0 | restbyname -xvqdf- ./<path_to_directory>
    sbread -x rmt0 | restbyname -xvqf- ./<path_to_file>
    

    If the Packed flag's value is Y, use one of the following commands depending on the type of data being restored:

    sbread -x rmt0 | sbuncomp | restbyname -xvqdf- ./<path_to_directory>
    sbread -x rmt0 | sbuncomp | restbyname -xvqf- ./<path_to_file>
    

    As an example, if you are restoring /tmp, first rewind the tape, and reposition it to the correct image:

         sbdevice -r rmt0
         sbdevice -f4 rmt0.1
    

    To restore the /tmp directory, enter:

         sbread -x rmt0 | restbyname -xvqdf- ./tmp
    

    To restore only the /etc/passwd file, enter:

         sbread -x rmt0 | restbyname -xvqf- ./etc/passwd
    

Instructions for Sysback version 4

  1. Follow the instructions in the section entitled Determining the block size but return to this section when complete.

  2. Before restoring, you must change the working directory to the appropriate location to restore files to. If you need to restore the file/directory to its original location, enter the following command:
         cd /
    

    If you need to restore to a different destination other than the original location, change the directory to the desired location.

  3. Rewind the tape drive, enter:
         tctl -f /dev/rmt0 rewind
    
  4. Fast forward the tape drive to the Sysback header on the tape for rootvg, enter:
         tctl -f /dev/rmt0.1 fsf 4
    
  5. View the header information and note the values for the Packed and Bkend attributes, enter:
         sbread -H rmt0.1
    
    -----------| Example Header |------------
    Date:          Fri Feb 18 12:43:15 2000
    User:          root
    Host:          mars
    Type:          TOC - System Backup
    Data:          rootvg
    Size:          219 megabytes
    Packed:        N
    Buffer:        64 Kbytes
    Bkend:         B
    Volume:        1
    Backup Volume:      1
    Image Number:  1
    -----------| End Example |---------------
    
  6. Rewind the tape drive again, enter:
         tctl -f /dev/rmt0 rewind
    
  7. Fast forward the tape drive to the correct image to restore data from. This list of images will vary from volume group to volume group, but the default list for the rootvg volume group will appear as follows:
    First data image: /dev/hd4 mounted on /
    Second data image: /dev/hd2 mounted on /usr
    Subsequent data images: (Each filesystem and raw logical volume in alphabetical order (excluding / and /usr) will have one data image each.

    As an example, a default rootvg would consist of the following filesystems in order on the Sysback tape:

    1. /
    2. /usr
    3. /home
    4. /tmp
    5. /var

    If you created a filesystem named /data which was present in the rootvg, then the list of data images would appear in the order:

    1. /
    2. /usr
    3. /data
    4. /home
    5. /tmp
    6. /var

    For Sysback version 4, each filesystem and raw logical volume is contained in its own separate individual images on tape. rootvg volume group data images are located on the tape after the boot image and Sysback images. The data images start at image number 6 on the tape. The first five images are the boot image, an install image, a dummy image, a Sysback program install image, and the Sysback table of contents for the backup.

    To restore from the first data image (/) on the Sysback tape, enter the following command to forward the tape to the correct position:

         tctl -f /dev/rmt0.1 fsf 5
    

    The preceding command will correctly position the tape so that it is positioned before the first data image, which is actually the sixth image on the tape. The /usr filesystem would be the seventh image, and the other filesystems raw logical volumes would follow.

  8. Now the restore may be started. The ./<path> designation in the command will need to be replaced by the full path to the file or directory to be restored.

    NOTE: Do not include the filesystem mount point in the path. For example, if restoring the directory /tmp, then only the path ./ would be specified. The filesystem mount point is already assumed by the command as it knows what image it is restoring the data from.

    If the Packed value is N and the Bkend value is B, use one of the following commands:

    sbread -x rmt0 | restbyname -xvqdf- ./<path_to_directory>
    sbread -x rmt0 | restbyname -xvqf- ./<path_to_file>
    

    If the Packed value is N, and the Bkend value is T, use one of the following commands:

    sbread -x rmt0 | tar -xvf ./<path_to_directory>
    sbread -x rmt0 | tar -xvf ./<path_to_file>
    

    If the Packed value is Y and the Bkend value is B, use one of the following commands:

    sbread -x rmt0 | sbuncomp | restbyname -xvqdf- ./<path_to_directory>
    sbread -x rmt0 | sbuncomp | restbyname -xvqf- ./<path_to_file>
    

    If the Packed value is Y and the Bkend value is T, use one of the following commands:

    sbread -x rmt0 | sbuncomp | tar -xvf ./<path_to_directory>
    sbread -x rmt0 | sbuncomp | tar -xvf ./<path_to_file>
    

    As an example, if you are restoring /tmp, you would first rewind the tape, reposition it to the correct image so the following commands could be executed:

         tctl -f /dev/rmt0 rewind
         tctl -f /dev/rmt0.1 fsf 9
    

    To restore the /tmp directory, enter:

         sbread -x rmt0 | restbyname -xvqdf- ./
    

    To restore only the /tmp/tempdata/datalog file, enter:

         sbread -x rmt0 | restbyname -xvqf- ./tempdata/datalog
    

Determining the block size

  1. Rewind the tape drive, enter:
         tctl -f /dev/rmt0 rewind
    
  2. Change the working directory to /:
         cd /
    
  3. Forward the tape to the end of the third image, enter:
         tctl -f /dev/rmt0.1 fsf 3
    
  4. Restore the block size file, enter:
         restbyname -xvqf /dev/rmt0.1 ./tmp/...blksz
    
  5. Rewind the tape drive, enter:
         tctl -f /dev/rmt0 rewind
    
  6. Read the block size file, enter:
         cat ./tmp/...blksz
    
  7. Now the tape drive's block size needs to be set to the value contained in the ...blksz file. The X in the command below will be the output from step 6 in this section:
         chdev -a block_size=X -l rmt0
    
  8. Resume at the next step in the appropriate section for Sysback version 3 or version 4.

Differences between Sysback versions 3 and 4

The purpose of this section is to describe the differences between versions 3 and 4 of Sysback.

Images on tape

Version 3 of Sysback has four images on tape before the data images in the following order:

  1. boot image
  2. install image
  3. dummy image
  4. Sysback program image

All subsequent images consist of one image per volume group that was included in the backup starting with rootvg.

Version 4 of Sysback has five images on tape before the data images in the following order:

  1. boot image
  2. install image
  3. dummy image
  4. Sysback program image
  5. table of contents (TOC) file

All subsequent images consist of the raw logical volumes and filesystems that constitute the volume groups in the following order:

  1. /
  2. /usr
  3. All remaining filesystems and raw logical volumes belonging to rootvg in alphabetical order.
  4. All subsequent images consist of the filesystems and raw logical volumes of each nonrootvg volume group in alphabetical order. The order in which the nonrootvg volume groups appear on the backup depends on the order in which they were backed up.

For example, if a Sysback version 4 backup contains a standard rootvg volume group (no user made logical volumes or filesystems), a datavg volume group consisting of the filesystems /data, /data2, /mail, and a volume group called dbvg with the filesystems /db1, db2, /orders, then the order of the images on the tape would be as follows assuming that datavg is before dbvg:

  1. boot image
  2. install image
  3. dummy image
  4. Sysback program image
  5. table of contents (TOC)
  6. /
  7. /usr
  8. /home
  9. /tmp
  10. /var
  11. /data
  12. /data2
  13. /mail
  14. /db1
  15. /db2
  16. /orders

Filesystem mountpoint in restore path

The filesystem mountpoint is included in all Sysback version 3 restores because all of the filesystems are included in the same image. The filesystem mountpoint is not included in any Sysback version 4 restores because every filesystem is in its own data image. This helps with reduced filelist sizes as the filesystem mountpoint is written only to the header.


[ Doc Ref: 96394324025386     Publish Date: Jan. 23, 2001]