1) To restore individual file or dirs. From a mksysb tape, find the blocksize of the 4th image on tape . To obtain this info. Run the following cmd after mounting mksysb tape:
cd /tmp
tctl -f /dev/rmt0 rewind
chdev -l rmt0 -a block_size=512
restore -s2 -xqdvf /dev/rmt0.1 ./tapeblksz
cat ./tapebklsz
The output that is given will be the blocksize the tape drive was set to when the mksysb was made
2) Next , the blocksize needs to be set accordingly by running the following cmd: chdev -l /dev/rmt0 -a block_size=[ number in the ./tapeblksz file]
3) The files or dirs. need to be restored by running the following cmd : cd / (if the file needs to be restored to its original place)
4) tctl -f /dev/rmt0 rewind
5) restore -s4 xqdvf /dev/rmt0.1 ./dir/filename(for one file)
6) OR restore -s4 -xqdvf /dev/rmt0.1 ./dir (for all files in dir)
Eg to restore /etc to a temp area
cd /backup/tmp
tctl -f /dev/rmt0 rewind
restore -s4 -xqdvf /dev/rmt0.1 ./etc
you can restore eg. /var or /usr or /public/prod in the above way
Sometimes, you just need that one single file from a mksysb image backup. It's really not that difficult to accomplish this.
To see which files are in the mksysb backup
$ restore -Tvqf alpha.mksysb
New volume on alpha.mksysb:
Cluster 51200 bytes (100 blocks).
Volume number 1
Date of backup: Thu Sep 29 22:52:26 2011
Files backed up by name
User root
6045 ./bosinst.data
11 ./tmp/vgdata/rootvg/image.info
11077 ./image.data
189116 ./tmp/vgdata/rootvg/backup.data
0 ./usr/sys/inst.images
0 ./usr/sys/inst.images/installp
To restore the single file:
$ restore -xvqf alpha.mksysb ./etc/passwd
New volume on alpha.mksysb:
Cluster 51200 bytes (100 blocks).
Volume number 1
Date of backup: Thu Sep 29 22:52:26 2011
Files backed up by name
User root
x 612 ./etc/passwd
total size: 612
files restored: 1
Please do not forget . (point) before file name to restore.
$ ls -l ./etc/passwd
-rw-r--r-- 1 root security 612 Aug 28 23:04 ./etc/passwd
First of all, go to the directory that contains the mksysb image file:
# cd /sysadm/iosbackupIn this example, were using the mksysb image of a Virtual I/O server, created using iosbackup. This is basically the same as a mksysb image from a regular AIX system. The image file for this mksysb backup is called vio1.mksysb
First, try to locate the file you're looking for; For example, if you're looking for file nimbck.ksh:
# restore -T -q -l -f vio1.mksysb | grep nimbck.ksh
New volume on vio1.mksysb:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Thu Jun 9 23:00:28 MST 2011
Files are backed up by name.
The user is padmin.
-rwxr-xr-x- 10 staff May 23 08:37 1801 ./home/padmin/nimbck.ksh
Here you can see the original file was located in /home/padmin. Now recover that one single file:
# restore -x -q -f vio1.mksysb ./home/padmin/nimbck.ksh
x ./home/padmin/nimbck.ksh
Note that it is important to add the dot before the filename that needs to be recovered. Otherwise it won't work. Your file is now restore to ./home/padmin/nimbck.ksh, which is a relative folder from the current directory you're in right now:# cd ./home/padmin # ls -als nimbck.ksh 4 -rwxr-xr-x 1 10 staff 1801 May 23 08:37 nimbck.ksh