此例中所有备份都是备份到本地文件系统上执行
smitty mksysb 备份rootvg 到本地文件 /sysb/sysb.image
smitty savevg 备份datavg到本地文件 /sysb/datavg
无论是使用mksysb还是savevg的备份,其格式均为backup格式,使用tar命令是不能执行恢复的,需要使用restore命令才能恢复。
查看备份介质上的备份内容:
不管是mksysb还是savevg备份,都可以使用smitty listtoc 查看备份内容。该命令实际上调用的是 restore –Tqv –f /sysb/sysb.image。
smitty listtoc
List Contents of a Backup
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Backup DEVICE [/sysb/sysb.image] +/
VERBOSE output? no +
F1=Help F2=Refresh F3=Cancel F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
如果是mksysb介质,还可以使用smitty lsmksysb来查看备份内容
如果是savevg介质,就可以使用 smitty lsbackvg来查看备份内容
以上两个命令实际上是 调用 listvgbackup 命令
以下是执行smitty lsmksysb命令的输出。不难看出,在备份介质中,数据文件的路径是以相对路径开头的,即以 。开头,所以在恢复过程中要值得注意。
COMMAND STATUS
Command: OK stdout: yes stderr: no
Before command completion, additional instructions may appear below.
[TOP]
New volume on /sysb/sysb.image:
Cluster size is 51200 bytes (100 blocks).
The volume number is 1.
The backup date is: Mon Jan 16 14:47:44 BEIST 2006
Files are backed up by name.
The user is root.
9217 ./bosinst.data
9087 ./image.data
0 ./sysb
0 ./sysb/lost+found
0 ./opt
0 ./opt/lost+found
6 ./opt/freeware/bin/mdir
6 ./opt/freeware/bin/mdu
6 ./opt/freeware/bin/mformat
6 ./opt/freeware/bin/minfo
5210 ./opt/freeware/bin/mkmanifest
4 ./var/adm/cron/at.deny
3 ./var/adm/cron/cron.deny
123304 ./var/adm/cron/log
899 ./var/adm/cron/queuedefs
0 ./var/adm/cron/FIFO
0 ./var/adm/ras
198904 ./var/adm/ras/codepoint.cat
101498 ./var/adm/ras/errtmplt
……………………………………
文件恢复:
恢复文件的话,有两种恢复方式
1,一种是smitty restfile,即调用restore命令恢复,该命令可以恢复mksysb和savevg的数据文件。restore -xvq -f /sysb/sysb.image ./etc/passwd
smitty restfile
Restore a File or Directory
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Restore DEVICE [/sysb/sysb.image] +/
* Target DIRECTORY [.] /
FILE or DIRECTORY to restore [./etc/passwd]
(Leave blank to restore entire archive.)
VERBOSE output? no +
Number of BLOCKS to read in a single input operation [] #
F1=Help F2=Refresh F3=Cancel F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
2,一种是 smitty restmksysb ;即调用restorevgfiles 命令
而对于savevg备份,必须使用smitty restsavevg,它也是调用restorevgfiles命令
smitty restmksysb
Restore Files in a Volume Group Backup
Type or select values in entry fields.
Press Enter AFTER making all desired changes.
[Entry Fields]
* Restore DEVICE or FILE [/sysb/sysb.image] +/
FILES to restore [./etc/passwd]
(Leave blank to restore entire archive)
Number of BLOCKS to read in a single input [] #
(Leave blank to use a system default)
Verify BLOCK size if tape device? no +
F1=Help F2=Refresh F3=Cancel F4=List
Esc+5=Reset Esc+6=Command Esc+7=Edit Esc+8=Image
Esc+9=Shell Esc+0=Exit Enter=Do
注意到smitty restfile与smitty restmksysb命令的不同(以上红色表明),前者可以把文件恢复到任何目录,但前提是target directory 项 必须填入你所需要恢复到的目录路径, 。 代表运行shell的当前路径。后者只能把文件恢复到原有路径,比如./etc/passwd只能恢复到/etc目录