Restoring Files/Directories in Service Mode with Sysback


Contents

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


About this document

This document describes how to manipulate the tape drive in service mode when booted from a Sysback bootable backup tape and how to restore individual files and directories from service mode using Sysback specific low-level commands.

The information in this document applies to AIX Versions 3.2.5 and above with Sysback versions 3 and 4.

NOTE: This method does NOT replace the full functionality of recovering an entire rootvg volume group. Use normal Sysback methods and procedures to restore an entire system. The method described in this document is only for recovering individual files when you do not need to restore the entire rootvg volume group. 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 that system stability may be compromised. So, in many cases it is advised to recover rootvg volume group 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 can be found with the following command:

	lsdev -C | more

Note that the rmt device names will not necessarily be equivalent to the rmt device names when the system is/was in normal mode.

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 and can be accessed at the following URL:
http://www.rs6000.ibm.com/resource/aix_resource/Pubs/index.html


Instructions for Sysback version 3

  1. Boot the system from a Sysback network boot image or from a Sysback tape. Contact your AIX support center for more details on this step. There may be a technical document available for such information.
  2. Select the option, Start a limited function MAINTENANCE shell from the System Installation and Maintenance main menu.
  3. Follow the instructions below in the section Determining the block size but return to this section when complete.
  4. Select the option Start a limited function MAINTENANCE shell from the System Installation and Maintenance main menu.
  5. At the ksh> prompt, enter the following command:
    	getrootfs
    
  6. Select to import the rootvg volume group without mounting any filesystems. This is option number 2:
    	start a shell before mounting filesystems
    
  7. You should now be at the maintenance shell again:
    	ksh>
    
  8. Now the appropriate filesystem(s) from the imported rootvg volume group needs to be mounted. The exact filesystem will be determined by whatever is being restored, but the / and /usr filesystems will be used in this document for the following example commands:
    	mount /dev/hd4 /mnt
    	mount /dev/hd2 /mnt/usr
    

    This preceding commands would mount the / filesystem on the /mnt mount point. Following is a list of the default mount points and logical volume names for each of the rootvg volume group filesystems.

    	Filesystem		Mounted on
    	/dev/hd4		/
    	/dev/hd2		/usr
    	/dev/hd9var		/var
    	/dev/hd3		/tmp
    	/dev/hd1		/home
    
  9. Before restoring, you must change the working directory to the appropriate location to restore files. For restoring the /etc directory, for example, you need to cd to /mnt because it is the mount point for the / filesystem, enter:
    	cd /mnt
    
  10. Running the following command will show the files and directories contained in the current working directory:
    	echo *
    
  11. Continuing the use of our example of restoring the /etc directory, the following commands would be used to properly position the tape so that the /etc directory may be restored from the correct data image.

  12. Rewind the tape drive:
    	sbdevice -r rmt0
    
  13. Fast forward the tape drive to the Sysback header on the tape for rootvg by entering the following:
    	sbdevice -f4 rmt0.1
    
  14. View the header information and check to see if the Packed field has a value of Y or N by entering the command below:
    	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 |---------------
    
  15. Rewind the tape drive again:
    	sbdevice -r rmt0
    
  16. 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, the dummy image, and the Sysback program install image - the next image would be rootvg, and any subsequent images on tape would consist of each of the nonroot 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. Sysback version 4 has five images before the first image in rootvg.

    So, 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:

    	sbdevice -f4 rmt0.1
    

    The preceding command will position the tape so that it is positioned before the root 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.

  17. 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: You must include the filesystem mount point in the path. This is different from Sysback version 4 (see below for details).

    If the Packed value is N, 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 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, you would 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

  1. Boot the system from a Sysback network boot image or from a Sysback tape. Contact your AIX support center for more details on this step. There may be a technical document available for such information.
  2. Select the option Start a limited function MAINTENANCE shell from the System Installation and Maintenance main menu.
  3. Follow the instructions below in the section Determining the block size but return to this section when complete.
  4. Select the option Start a limited function MAINTENANCE shell from the System Installation and Maintenance main menu.
  5. At the ksh> prompt, enter the following command:
    	getrootfs
    
  6. Select to import the root volume group without mounting any filesystems. This is option number 2:
    	start a shell before mounting filesystems
    
  7. Continue with step 8 in the section Instructions for Sysback version 4.2.

Instructions for Sysback version 4.2

  1. Boot the system from a Sysback network boot image or from a Sysback tape. Contact your AIX support center for more details on this step. There may be a technical document available for such information.
  2. Select the option Utilities from the Installation & Maintenance MAIN MENU.
  3. Select the option Start a Maintenance Shell.
  4. Follow the instructions below in the section entitled Determining the block size but return to this section when complete.
  5. Select the option Utilities from the Installation & Maintenance MAIN MENU.
  6. Select the option Import the rootvg Volume Group.
  7. Select the proper physical volume to import the rootvg volume group from and enter n when prompted to mount filesystems after importing. Enter n when prompted to rebuild the boot logical volume. See the AIX System Backup & Recovery/6000 Version 4 User and Reference Manual, "Chapter 13" for more information on importing the rootvg volume group.
  8. You should now be at the maintenance shell:
    	ksh>
    
  9. Now the appropriate filesystem from the imported rootvg volume group needs to be mounted. The exact filesystem will be determined by whatever is being restored, but the / filesystem will be used in this document for the following example command:
    	mount /dev/hd4 /mnt
    

    This would mount the / filesystem on the /mnt mount point. Following is a list of the default mount points and logical volume names for each of the rootvg volume group filesystems.

    	Filesystem		Mounted on
    	/dev/hd4		/
    	/dev/hd2		/usr
    	/dev/hd9var		/var
    	/dev/hd3		/tmp
    	/dev/hd1		/home
    
  10. Before restoring, you must change the working directory to the appropriate location to restore files. For restoring the /etc directory, for example, you need to change directories to /mnt as it is the mount point for the / filesystem:
    	cd /mnt
    
  11. Running the following command will show the files and directories contained in the current working directory:
    	echo *
    
  12. Continuing the use of our example of restoring the /etc directory, the following commands would be used to properly position the tape so that the /etc directory may be restored from the correct data image. Rewind the tape drive:
    	sbdevice -r rmt0
    
  13. Fast forward the tape drive to the Sysback header on the tape:
    	sbdevice -f5 rmt0.1
    
  14. View the header information and note the values for the Packed and Bkend attributes by entering the command below.
    	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 |---------------
    
  15. Rewind the tape drive again:
    	sbdevice -r rmt0
    
  16. 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 volume group 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 were present in the rootvg, 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 their 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:

    	sbdevice -f5 rmt0.1
    
    The preceding command will place 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.
  17. 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 /usr/lpp, only the path ./lpp 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 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 Bkend value is T, use one of the following commands depending on the type of data being restored:

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

    If the Packed value is Y and if the Bkend value is B, 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
    

    If the Bkend value is T, use one of the following commands depending on the type of data being restored:

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

    As an example, if we are restoring /usr/lib, we would first rewind the tape, and reposition it to the correct image so the following commands would be run:

    	sbdevice -r rmt0
    	sbdevice -f6 rmt0.1
    

    To restore the /usr/lib directory:

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

    To restore only the /usr/lib/libc.a file:

    	sbread -x rmt0 | restbyname -xvqf- ./lib/libc.a
    
  18. Once the restore is complete, enter the following commands:
    	sync;sync;sync;
    	cd /
    	unmount all
    

    If hd4 and hd2 do not unmount, turn key to normal (if a key exists) and reboot.

    	exit
    
  19. Turn the key to normal (if a key exists) and reboot.

Determining the block size

  1. Rewind the tape drive:
    	sbdevice -r /dev/rmt0
    
  2. Change the working directory to /:
    	cd /
    
  3. Forward the tape to the end of the third image:
    	sbdevice -f3 /dev/rmt0.1
    
  4. Restore the block size file:
    	restbyname -xvqf /dev/rmt0.1 ./tmp/...blksz
    
  5. Rewind the tape drive:
    	sbdevice -r /dev/rmt0
    
  6. Read the block size file:
    	cat ./tmp/...blksz
    
  7. Now the tape drive's block size needs to be set to the value contained in the ...blksz file. Follow the appropriate section depending on whether it is a stand alone SCSI tape drive or a tape drive that requires the Atape.driver. Contact the AIX support center if any assistance is needed to determine the type of tape drive.

    For tape drives that require the Atape.driver (most autoloaders, 3590, 3570), run the following commands:

    1. Set the drive to a defined state:
      	/usr/lib/methods/ucfgAtape -l rmt0
      
    2. Change the block size. The X in the command below will be the output from step 6 in this section:
      	/usr/lib/methods/chggen -l rmt0 -a block_size=X
      
    3. Make the tape drive available:
      	/usr/lib/methods/cfgAtape -l rmt0
      

    For regular stand alone SCSI tape drives:

    1. Set the tape drive to defined state:
      	/usr/lib/methods/ucfgdevice -l rmt0
      
    2. Change the block size. The X in the command below will be the output from step 6 in this section:
      	/usr/lib/methods/chggen -l rmt0 -a block_size=X
      
    3. Make the tape drive available:
      	/usr/lib/methods/cfgsctape -l rmt0
      
  8. Exit the maintenance shell to return to the Sysback installation main menu:
    	ksh> exit
    
  9. Resume at the next step in the appropriate section for Sysback version 3, 4.1, or 4.2.

Differences between Sysback versions 3 and 4

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

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 and they are present in the following order:

  1. /
  2. /usr
  3. (all remaining filesystems and raw logical volumes belonging to rootvg in alphabetical order.)

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 depend 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: 96394312721128     Publish Date: Oct. 02, 2000     4FAX Ref: 8601 ]