In future few days,i'm going to write few articles about IBM AIX 6.1 Administrator(000-104) test contents.This article only show you how to backup and recovery on AIX.On AIX,there are many commands that you can backup and restore AIX OS and user data.Such as mksysb,backup,savevg,restvg and so on.This article includes two part: backup AIX OS and reset root password in maintenance mode.
一.Backup AIX OS and user data
In this part,i'll use mksysb,savevg and restvg to backup AIX OS data.
1.Using mksysb command:
Before you do,ensure that the only backs up files and directories in rootvg that are mounted.I have no tape,so i backup os to a file,the file path can be local or nfs-mounted.
- [root@dbserv1 /]# mksysb -iX /mnt/tmp/aix6106.img
- Creating information file (/image.data) for rootvg.
- Creating list of files to back up. .
- Backing up 82174 files..............................
- 60716 of 82174 files (73%)........
- 82174 of 82174 files (100%)
- 0512-038 mksysb: Backup Completed Successfully.
- [root@dbserv1 /]#
After that you can use following command or listvgbackup –lf /mnt/tmp/aix6106.img instead of lsmksysb as well to show infromation about filesystems and OS level of the image.
- [root@dbserv1 /]# lsmksysb -l -f /mnt/tmp/aix6106.img
- VOLUME GROUP: rootvg
- BACKUP DATE/TIME: Sun May 6 13:52:11 CDT 2012
- UNAME INFO: AIX dbserv1 1 6 000C1ACF4C00
- BACKUP OSLEVEL: 6.1.6.0
- MAINTENANCE LEVEL: 6100-06
- BACKUP SIZE (MB): 18688
- SHRINK SIZE (MB): 5591
- VG DATA ONLY: no
- rootvg:
- LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
- hd5 boot 1 2 2 closed/syncd N/A
- hd6 paging 8 16 2 open/syncd N/A
- hd8 jfs2log 1 2 2 open/syncd N/A
- hd4 jfs2 11 22 2 open/syncd /
- hd2 jfs2 86 172 2 open/syncd /usr
- hd9var jfs2 15 30 2 open/syncd /var
- hd3 jfs2 2 4 2 open/syncd /tmp
- hd1 jfs2 1 2 2 open/syncd /home
- hd10opt jfs2 7 14 2 open/syncd /opt
- hd11admin jfs2 2 4 2 open/syncd /admin
- lg_dumplv sysdump 16 16 1 open/syncd N/A
- livedump jfs2 4 8 2 open/syncd /var/adm/ras/livedump
2.Using savevg and restvg:
When you excute savevg command,the volume group should be vary-on and filesystems should be mounted.Here i use it to backup appvg:
- [root@dbserv1 /]# savevg -if /mnt/tmp/appvg.img appvg
- Creating information file for volume group appvg..
- Creating list of files to back up.
- Backing up 39 files
- 39 of 39 files (100%)
- 0512-038 savevg: Backup Completed Successfully.
- [root@dbserv1 /]#
After that,you can use restvg to display infromation about filesystems and OS level of the image.
- [root@dbserv1 /]# restvg -lf /mnt/tmp/appvg.img
- VOLUME GROUP: appvg
- BACKUP DATE/TIME: Sun May 6 14:40:05 CDT 2012
- UNAME INFO: AIX dbserv1 1 6 000C1ACF4C00
- BACKUP OSLEVEL: 6.1.6.0
- MAINTENANCE LEVEL: 6100-06
- BACKUP SIZE (MB): 20608
- SHRINK SIZE (MB): 145
- VG DATA ONLY: no
- appvg:
- LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
- vol02 jfs2 160 160 1 open/syncd /u02
- loglv01 jfs2log 1 1 1 open/syncd N/A
3.Using restvg to restore:
Before restore appvg,i must destroy it then i can restore it successful.
- [root@dbserv1 /]# rmlv -f vol02
- rmlv: Logical volume vol02 is removed.
- [root@dbserv1 /]# rmlv -f loglv01
- rmlv: Logical volume loglv01 is removed.
- [root@dbserv1 /]# reducevg appvg hdisk3
- [root@dbserv1 /]# lspv
- hdisk0 000c1acf8b46ce33 rootvg active
- hdisk1 000c1acfff83f336 rootvg active
- hdisk3 000c1acf23b27e7a None
Restoring appvg:
- [root@dbserv1 /]# restvg -f /mnt/tmp/appvg.img hdisk3
- Will create the Volume Group: appvg
- Target Disks: hdisk3
- Allocation Policy:
- Shrink Filesystems: no
- Preserve Physical Partitions for each Logical Volume: no
- Enter y to continue: y
- appvg
- vol02
- loglv01
- New volume on /mnt/tmp/appvg.img:
- Cluster size is 51200 bytes (100 blocks).
- The volume number is 1.
- The backup date is: Sun May 6 14:40:19 CDT 2012
- Files are backed up by name.
- The user is root.
- x 10 ./tmp/vgdata/appvg/image.info
- x 122 ./tmp/vgdata/vgdata.files6291582
- x 122 ./tmp/vgdata/vgdata.files
- x 2315 ./tmp/vgdata/appvg/filesystems
- x 2694 ./tmp/vgdata/appvg/appvg.data
- x 351 ./tmp/vgdata/appvg/backup.data
- x 0 ./u02
- x 7825 ./u02/aixmibd.conf
- x 754 ./u02/cdrecord.conf
- x 3591 ./u02/cdromd.conf
- x 2298 ./u02/clsnmp.conf
- x 3582 ./u02/cronlog.conf
- x 1138 ./u02/dfpd.conf
- x 1538 ./u02/dlpi.conf
- x 0 ./u02/etc
- x 2315 ./u02/etc/filesystems
- x 50798 ./u02/gated.conf
- x 1161 ./u02/hba.conf
- x 1964 ./u02/hostmibd.conf
- x 1967 ./u02/hosts
- x 5131 ./u02/inetd.conf
- x 4331 ./u02/isakmpd.conf
- x 0 ./u02/lost+found
- x 2423 ./u02/mrouted.conf
- x 4716 ./u02/netsvc.conf
- x 3004 ./u02/nscontrol.conf
- x 993 ./u02/ntp.conf
- x 4066 ./u02/pam.conf
- x 2220 ./u02/policyd.conf
- x 3320 ./u02/pse.conf
- x 2058 ./u02/pse_tune.conf
- x 44 ./u02/resolv.conf
- x 3027 ./u02/rsvpd.conf
- x 5495 ./u02/slp.conf
- x 10128 ./u02/snmpd.conf
- x 10256 ./u02/snmpdv3.conf
- x 1956 ./u02/snmpmibd.conf
- x 4408 ./u02/syslog.conf
- x 1222 ./u02/telnet.conf
- x 1717 ./u02/xtiso.conf
- The total size is 155060 bytes.
- The number of restored files is 40.
Exclude restvg command on AIX,you can use restore command to restore.
- [root@dbserv1 /]# restore -xvqf /mnt/tmp/appvg.img
- New volume on /mnt/tmp/appvg.img:
- Cluster size is 51200 bytes (100 blocks).
- The volume number is 1.
- The backup date is: Sun May 6 14:40:19 CDT 2012
- Files are backed up by name.
- The user is root.
- x 10 ./tmp/vgdata/appvg/image.info
- x 122 ./tmp/vgdata/vgdata.files6291582
- x 122 ./tmp/vgdata/vgdata.files
- x 2315 ./tmp/vgdata/appvg/filesystems
- x 2694 ./tmp/vgdata/appvg/appvg.data
- x 351 ./tmp/vgdata/appvg/backup.data
- x 0 ./u02
- x 7825 ./u02/aixmibd.conf
- x 754 ./u02/cdrecord.conf
- x 3591 ./u02/cdromd.conf
- x 2298 ./u02/clsnmp.conf
- x 3582 ./u02/cronlog.conf
- x 1138 ./u02/dfpd.conf
- x 1538 ./u02/dlpi.conf
- x 0 ./u02/etc
- x 2315 ./u02/etc/filesystems
- x 50798 ./u02/gated.conf
- x 1161 ./u02/hba.conf
- x 1964 ./u02/hostmibd.conf
- x 1967 ./u02/hosts
- x 5131 ./u02/inetd.conf
- x 4331 ./u02/isakmpd.conf
- x 0 ./u02/lost+found
- x 2423 ./u02/mrouted.conf
- x 4716 ./u02/netsvc.conf
- x 3004 ./u02/nscontrol.conf
- x 993 ./u02/ntp.conf
- x 4066 ./u02/pam.conf
- x 2220 ./u02/policyd.conf
- x 3320 ./u02/pse.conf
- x 2058 ./u02/pse_tune.conf
- x 44 ./u02/resolv.conf
- x 3027 ./u02/rsvpd.conf
- x 5495 ./u02/slp.conf
- x 10128 ./u02/snmpd.conf
- x 10256 ./u02/snmpdv3.conf
- x 1956 ./u02/snmpmibd.conf
- x 4408 ./u02/syslog.conf
- x 1222 ./u02/telnet.conf
- x 1717 ./u02/xtiso.conf
- The total size is 155060 bytes.
- The number of restored files is 40.
Following command only show the contents of a backup:
- restore –Tvqf /mnt/tmp/appvg.img
二.Resetting root password:
When you reset root password in maintenance mode,make sure you have AIX media.
1.Boot your machine from AIX media,mksysb tape or NIM server.The boot resource should have the same version and TL as the system you want to recover. For example, an AIX 6.1 with TL6 cannot be recovered by AIX 6.1 TL2 media or NIM resource.
2.Choose Start Maintenance Mode for System Recovery
3.Select Access a Root Volume Group
4.Type 0 and press Enter
5.Type the number of the appropriate volume group from the list and press Enter.
6.Select Access this Volume Group and start a shell by typing 1 and press Enter.
- Importing Volume Group...
- rootvg
- Checking the / filesystem.
- The current volume is: /dev/hd4
- Primary superblock is valid.
- J2_LOGREDO:log redo processing for /dev/hd4
- Primary superblock is valid.
- Checking the /usr filesystem.
- The current volume is: /dev/hd2
- Primary superblock is valid.
- Saving special files and device configuration information.
- Unable to stat /dev directory on disk
- Recreating /dev directory on disk
- Changed: console
- Changed: error
- Changed: errorctl
- Changed: kmem
- Changed: mem
- Changed: pmem
- Changed: null
- Changed: nvram
- Changed: sysdump
- Changed: sysdumpctl
- Changed: sysdumpfile
- Changed: sysdumpnull
- Changed: tty
- Changed: pci0
- Changed: pci1
- Changed: isa0
- Changed: pci2
- Changed: pci3
- Changed: pci4
- Changed: pci5
- Changed: pci6
- Changed: pci7
- Changed: pci8
- Changed: pci9
- Changed: pci10
- Changed: pci11
- Changed: ide0
- Changed: rcd0
- Changed: sisscsia0
- Changed: cd0
- Changed: scsi0
- Changed: scsi1
- Changed: clone
- Changed: sad
- Changed: slog
- Changed: hdisk1
- Changed: rhdisk1
- Changed: hdisk0
- Changed: rhdisk0
- Changed: lai0
- Changed: lft0
- Changed: rcm0
- Changed: tty0
- Changed: rootvg
- Changed: IPL_rootvg
- Changed: __vg10
- Changed: rhd5
- Changed: hd5
- Changed: rhd6
- Changed: hd6
- Changed: rhd8
- Changed: hd8
- Changed: rhd4
- Changed: hd4
- Changed: rhd2
- Changed: hd2
- Changed: rhd9var
- Changed: hd9var
- Changed: rhd3
- Changed: hd3
- Changed: rhd1
- Changed: hd1
- Changed: rhd10opt
- Changed: hd10opt
- Changed: rhd11admin
- Changed: hd11admin
- Changed: rlg_dumplv
- Changed: lg_dumplv
- Changed: rlivedump
- Changed: livedump
- Changed: rloglv00
- Changed: loglv00
- Changed: ipl_blv
- Changed: ipldevice
- mergedev replaced 74 files in the hardfile /dev directory
- Checking and mounting the /tmp filesystem.
- The current volume is: /dev/hd3
- Primary superblock is valid.
- Checking and mounting the /var filesystem.
- The current volume is: /dev/hd9var
- Primary superblock is valid.
- Checking and mounting the /opt filesystem.
- The current volume is: /dev/hd10opt
- Primary superblock is valid.
- Filesystems mounted for maintenance work.
7.At the # (number sign) prompt, type the passwd command at the command line prompt to reset the root password.
- # passwd
- Changing password for "root"
- root's New password:
- Re-enter root's new password:
8.To write everything from the buffer to the hard disk and reboot the system, type the following:
- # sync;sync;sync;reboot
- Rebooting . . .