How To Backup And Recovery On IBM AIX

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.

 
 
  1. [root@dbserv1 /]# mksysb -iX /mnt/tmp/aix6106.img 
  2.  
  3. Creating information file (/image.data) for rootvg. 
  4.  
  5. Creating list of files to back up. .  
  6. Backing up 82174 files..............................  
  7. 60716 of 82174 files (73%)........ 
  8.  
  9. 82174 of 82174 files (100%)  
  10. 0512-038 mksysb: Backup Completed Successfully.  
  11. [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.

 
 
  1. [root@dbserv1 /]# lsmksysb -l -f /mnt/tmp/aix6106.img  
  2. VOLUME GROUP:           rootvg  
  3. BACKUP DATE/TIME:       Sun May 6 13:52:11 CDT 2012  
  4. UNAME INFO:             AIX dbserv1 1 6 000C1ACF4C00  
  5. BACKUP OSLEVEL:         6.1.6.0  
  6. MAINTENANCE LEVEL:      6100-06  
  7. BACKUP SIZE (MB):       18688  
  8. SHRINK SIZE (MB):       5591  
  9. VG DATA ONLY:           no 
  10.  
  11. rootvg:  
  12. LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT  
  13. hd5                 boot       1       2       2    closed/syncd  N/A  
  14. hd6                 paging     8       16      2    open/syncd    N/A  
  15. hd8                 jfs2log    1       2       2    open/syncd    N/A  
  16. hd4                 jfs2       11      22      2    open/syncd    /  
  17. hd2                 jfs2       86      172     2    open/syncd    /usr  
  18. hd9var              jfs2       15      30      2    open/syncd    /var  
  19. hd3                 jfs2       2       4       2    open/syncd    /tmp  
  20. hd1                 jfs2       1       2       2    open/syncd    /home  
  21. hd10opt             jfs2       7       14      2    open/syncd    /opt  
  22. hd11admin           jfs2       2       4       2    open/syncd    /admin  
  23. lg_dumplv           sysdump    16      16      1    open/syncd    N/A  
  24. 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:

 
 
  1. [root@dbserv1 /]# savevg -if /mnt/tmp/appvg.img appvg 
  2.  
  3. Creating information file for volume group appvg.. 
  4.  
  5. Creating list of files to back up. 
  6.  
  7. Backing up 39 files 
  8.  
  9. 39 of 39 files (100%)  
  10. 0512-038 savevg: Backup Completed Successfully.  
  11. [root@dbserv1 /]#  

After that,you can use restvg to display infromation about filesystems and OS level of the image.

 
 
  1. [root@dbserv1 /]# restvg -lf /mnt/tmp/appvg.img  
  2. VOLUME GROUP:           appvg  
  3. BACKUP DATE/TIME:       Sun May 6 14:40:05 CDT 2012  
  4. UNAME INFO:             AIX dbserv1 1 6 000C1ACF4C00  
  5. BACKUP OSLEVEL:         6.1.6.0  
  6. MAINTENANCE LEVEL:      6100-06  
  7. BACKUP SIZE (MB):       20608  
  8. SHRINK SIZE (MB):       145  
  9. VG DATA ONLY:           no 
  10.  
  11. appvg:  
  12. LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT  
  13. vol02               jfs2       160     160     1    open/syncd    /u02  
  14. 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.

 
 
  1. [root@dbserv1 /]# rmlv -f vol02  
  2. rmlv: Logical volume vol02 is removed. 
  3.  
  4. [root@dbserv1 /]# rmlv -f loglv01  
  5. rmlv: Logical volume loglv01 is removed. 
  6.  
  7. [root@dbserv1 /]# reducevg appvg hdisk3 
  8.  
  9. [root@dbserv1 /]# lspv  
  10. hdisk0          000c1acf8b46ce33                    rootvg          active  
  11. hdisk1          000c1acfff83f336                    rootvg          active  
  12. hdisk3          000c1acf23b27e7a                    None         

Restoring appvg:

 
 
  1. [root@dbserv1 /]# restvg -f /mnt/tmp/appvg.img hdisk3 
  2.  
  3. Will create the Volume Group:   appvg  
  4. Target Disks:   hdisk3  
  5. Allocation Policy:  
  6.         Shrink Filesystems:     no  
  7.         Preserve Physical Partitions for each Logical Volume:   no 
  8.  
  9. Enter y to continue: y  
  10. appvg  
  11. vol02  
  12. loglv01  
  13. New volume on /mnt/tmp/appvg.img:  
  14. Cluster size is 51200 bytes (100 blocks).  
  15. The volume number is 1.  
  16. The backup date is: Sun May  6 14:40:19 CDT 2012  
  17. Files are backed up by name.  
  18. The user is root.  
  19. x           10 ./tmp/vgdata/appvg/image.info  
  20. x          122 ./tmp/vgdata/vgdata.files6291582  
  21. x          122 ./tmp/vgdata/vgdata.files  
  22. x         2315 ./tmp/vgdata/appvg/filesystems  
  23. x         2694 ./tmp/vgdata/appvg/appvg.data  
  24. x          351 ./tmp/vgdata/appvg/backup.data  
  25. x            0 ./u02  
  26. x         7825 ./u02/aixmibd.conf  
  27. x          754 ./u02/cdrecord.conf  
  28. x         3591 ./u02/cdromd.conf  
  29. x         2298 ./u02/clsnmp.conf  
  30. x         3582 ./u02/cronlog.conf  
  31. x         1138 ./u02/dfpd.conf  
  32. x         1538 ./u02/dlpi.conf  
  33. x            0 ./u02/etc  
  34. x         2315 ./u02/etc/filesystems  
  35. x        50798 ./u02/gated.conf  
  36. x         1161 ./u02/hba.conf  
  37. x         1964 ./u02/hostmibd.conf  
  38. x         1967 ./u02/hosts  
  39. x         5131 ./u02/inetd.conf  
  40. x         4331 ./u02/isakmpd.conf  
  41. x            0 ./u02/lost+found  
  42. x         2423 ./u02/mrouted.conf  
  43. x         4716 ./u02/netsvc.conf  
  44. x         3004 ./u02/nscontrol.conf  
  45. x          993 ./u02/ntp.conf  
  46. x         4066 ./u02/pam.conf  
  47. x         2220 ./u02/policyd.conf  
  48. x         3320 ./u02/pse.conf  
  49. x         2058 ./u02/pse_tune.conf  
  50. x           44 ./u02/resolv.conf  
  51. x         3027 ./u02/rsvpd.conf  
  52. x         5495 ./u02/slp.conf  
  53. x        10128 ./u02/snmpd.conf  
  54. x        10256 ./u02/snmpdv3.conf  
  55. x         1956 ./u02/snmpmibd.conf  
  56. x         4408 ./u02/syslog.conf  
  57. x         1222 ./u02/telnet.conf  
  58. x         1717 ./u02/xtiso.conf  
  59. The total size is 155060 bytes.  
  60. The number of restored files is 40.  

Exclude restvg command on AIX,you can use restore command to restore.

 
 
  1. [root@dbserv1 /]# restore -xvqf /mnt/tmp/appvg.img 
  2. New volume on /mnt/tmp/appvg.img: 
  3. Cluster size is 51200 bytes (100 blocks). 
  4. The volume number is 1. 
  5. The backup date is: Sun May  6 14:40:19 CDT 2012 
  6. Files are backed up by name. 
  7. The user is root. 
  8. x           10 ./tmp/vgdata/appvg/image.info 
  9. x          122 ./tmp/vgdata/vgdata.files6291582 
  10. x          122 ./tmp/vgdata/vgdata.files 
  11. x         2315 ./tmp/vgdata/appvg/filesystems 
  12. x         2694 ./tmp/vgdata/appvg/appvg.data 
  13. x          351 ./tmp/vgdata/appvg/backup.data 
  14. x            0 ./u02 
  15. x         7825 ./u02/aixmibd.conf 
  16. x          754 ./u02/cdrecord.conf 
  17. x         3591 ./u02/cdromd.conf 
  18. x         2298 ./u02/clsnmp.conf 
  19. x         3582 ./u02/cronlog.conf 
  20. x         1138 ./u02/dfpd.conf 
  21. x         1538 ./u02/dlpi.conf 
  22. x            0 ./u02/etc 
  23. x         2315 ./u02/etc/filesystems 
  24. x        50798 ./u02/gated.conf 
  25. x         1161 ./u02/hba.conf 
  26. x         1964 ./u02/hostmibd.conf 
  27. x         1967 ./u02/hosts 
  28. x         5131 ./u02/inetd.conf 
  29. x         4331 ./u02/isakmpd.conf 
  30. x            0 ./u02/lost+found 
  31. x         2423 ./u02/mrouted.conf 
  32. x         4716 ./u02/netsvc.conf 
  33. x         3004 ./u02/nscontrol.conf 
  34. x          993 ./u02/ntp.conf 
  35. x         4066 ./u02/pam.conf 
  36. x         2220 ./u02/policyd.conf 
  37. x         3320 ./u02/pse.conf 
  38. x         2058 ./u02/pse_tune.conf 
  39. x           44 ./u02/resolv.conf 
  40. x         3027 ./u02/rsvpd.conf 
  41. x         5495 ./u02/slp.conf 
  42. x        10128 ./u02/snmpd.conf 
  43. x        10256 ./u02/snmpdv3.conf 
  44. x         1956 ./u02/snmpmibd.conf 
  45. x         4408 ./u02/syslog.conf 
  46. x         1222 ./u02/telnet.conf 
  47. x         1717 ./u02/xtiso.conf 
  48. The total size is 155060 bytes. 
  49. The number of restored files is 40. 

Following command only show the contents of a backup:

 
 
  1. 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.

 
 
  1. Importing Volume Group... 
  2. rootvg 
  3. Checking the / filesystem. 
  4.  
  5. The current volume is: /dev/hd4 
  6. Primary superblock is valid. 
  7. J2_LOGREDO:log redo processing for /dev/hd4                          
  8. Primary superblock is valid. 
  9. Checking the /usr filesystem. 
  10.  
  11. The current volume is: /dev/hd2 
  12. Primary superblock is valid. 
  13. Saving special files and device configuration information. 
  14. Unable to stat /dev directory on disk 
  15. Recreating /dev directory on disk 
  16. Changed: console 
  17. Changed: error 
  18. Changed: errorctl 
  19. Changed: kmem 
  20. Changed: mem 
  21. Changed: pmem 
  22. Changed: null 
  23. Changed: nvram 
  24. Changed: sysdump 
  25. Changed: sysdumpctl 
  26. Changed: sysdumpfile 
  27. Changed: sysdumpnull 
  28. Changed: tty 
  29. Changed: pci0 
  30. Changed: pci1 
  31. Changed: isa0 
  32. Changed: pci2 
  33. Changed: pci3 
  34. Changed: pci4 
  35. Changed: pci5 
  36. Changed: pci6 
  37. Changed: pci7 
  38. Changed: pci8 
  39. Changed: pci9 
  40. Changed: pci10 
  41. Changed: pci11 
  42. Changed: ide0 
  43. Changed: rcd0 
  44. Changed: sisscsia0 
  45. Changed: cd0 
  46. Changed: scsi0 
  47. Changed: scsi1 
  48. Changed: clone 
  49. Changed: sad 
  50. Changed: slog 
  51. Changed: hdisk1 
  52. Changed: rhdisk1 
  53. Changed: hdisk0 
  54. Changed: rhdisk0 
  55. Changed: lai0 
  56. Changed: lft0 
  57. Changed: rcm0 
  58. Changed: tty0 
  59. Changed: rootvg 
  60. Changed: IPL_rootvg 
  61. Changed: __vg10 
  62. Changed: rhd5 
  63. Changed: hd5 
  64. Changed: rhd6 
  65. Changed: hd6 
  66. Changed: rhd8 
  67. Changed: hd8 
  68. Changed: rhd4 
  69. Changed: hd4 
  70. Changed: rhd2 
  71. Changed: hd2 
  72. Changed: rhd9var 
  73. Changed: hd9var 
  74. Changed: rhd3 
  75. Changed: hd3 
  76. Changed: rhd1 
  77. Changed: hd1 
  78. Changed: rhd10opt 
  79. Changed: hd10opt 
  80. Changed: rhd11admin 
  81. Changed: hd11admin 
  82. Changed: rlg_dumplv 
  83. Changed: lg_dumplv 
  84. Changed: rlivedump 
  85. Changed: livedump 
  86. Changed: rloglv00 
  87. Changed: loglv00 
  88. Changed: ipl_blv 
  89. Changed: ipldevice 
  90. mergedev replaced 74 files in the hardfile /dev directory 
  91. Checking and mounting the /tmp filesystem. 
  92.  
  93. The current volume is: /dev/hd3 
  94. Primary superblock is valid. 
  95. Checking and mounting the /var filesystem. 
  96.  
  97. The current volume is: /dev/hd9var 
  98. Primary superblock is valid. 
  99. Checking and mounting the /opt filesystem. 
  100.  
  101. The current volume is: /dev/hd10opt 
  102. Primary superblock is valid. 
  103. 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.

 
 
  1. # passwd 
  2. Changing password for "root" 
  3. root's New password: 
  4. Re-enter root's new password: 

8.To write everything from the buffer to the hard disk and reboot the system, type the following:

 
 
  1. # sync;sync;sync;reboot 
  2. Rebooting . . . 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值