Monday, 27 July 2015

AIX-Backup and Recovery

mksysb

  • Creates an installable image of the root volume group either in a file or on to a bootable tape
  • Bootable tape is created in backup format
  • Can be restored individual files/directories using restore command
mksysb
        -e  /excludes files in /etc/exclude.rootvg 
        -i  to create image.data file
        -v  verbose mode 
        -X  extend /tmp filesystem if necessory for storing boot image
-i option calls mkszfile command which inturn creats /image.data file.
The bootable mksysb volume contains four images
  1. Boot image
  2. bosinstall image (image.data, bosinst.data, tapeblksz, etc..)
  3. An empty table of contents
  4. System Backup Image in Back up format
/bosinst.data file contains answer for questions during installation time such as Console name, Installation methode, locale seetings, etc.. If there is no /bostinst.data file present, then a sample file /usr/lpp/bosinst/bosinst.template is copied as /bosinst.data during backup process.

/image.data file contains logical volume and filesystem information of root volume group which is used by BOS install for creating target rootvg. If you want to create a custom image.data file, create the file using mkszfile, modify the file as per your requirement and call the mksysb command without -i option.
With these two files, it is possible to carry out an un-attended installation.
Examples:
To create system backup and create an /image.data file
 # mksysb -i /dev/rmt0
To exclude files and directories stored in /etc/exclude.rootvg file
 # mksysb -i -e /dev/rmt0
To store the mksysb image to a file called /stage/backp/mksysb.img
 # mksysb /stage/backp/mksysb.img

Backup or restore VGs using savevg and restvg

savevg command is used to backup volume groups other than rootvg
restvg command is used to restore volume groups other than rootvg
savevg
   -e excludes files/directories being backed in /etc/exclude.<vgname> file
   -i creates /tmp/vgdata/<vgname>/<vgname>.data file
   -f <device>  device or filename on which the image to be stored
   -v verbose mode
   -X automatically expand /tmp filesystem if required
-i option calls mkvgdata command which inturn creates /tmp/vgdata/<vgname>/<vgname>.data file
restvg

Backing up a filesytem or files

Restore files
restore
       -q  tells restore commnad that volume is ready
       -t, -T  to list the list of files in the backup archive
       -v  verbose
       -r  restores all files in the filesystem archive
       -x  to restore specifig files/directories
       -d  to restore all files in a directory if the File parameter is a directory
       -s <number>  To seek and restore the multiple backup tapes
To list the names of files in either a file-name or file-system archive
  # restore -Tq -f /dev/rmt0
To list all the files in a mksysb tape backup
  # restore -Tvqs 4 -f /dev/rmt0.1      
To restore an entire file-system archive, enter:
  # restore -rvqdf /dev/rmt0
To restore a specific file
  # restore -xvqf myhome.bkup system.data
To restore a specific file "/etc/passwd" from mksysb image file "mksysb.host1"
  # restore -xvqdf mksysb.host1 ./etc/passwd
Extracting data from mksysb tape
 a. Rewind the tape using the command:
    # tctl -f /dev/rmt0 rewind
 b. Move the tape forward to the third tape marker (beginning of fourth image):
    # tctl -f /dev/rmt0.1 fsf 3
 c. Restore data:
    # restore -xqvf /dev/rmt0.1 /tmp/my_file

No comments:

Post a Comment