11/25/96, 4FAX# 6524 Backing Up The Operating System SPECIAL NOTICES Information in this document is correct to the best of our knowledge at the time of this writing. Please send feedback by fax to "AIXServ Information" at (512) 823-4009. Please use this information with care. IBM will not be responsible for damages of any kind resulting from its use. The use of this information is the sole responsibility of the customer and depends on the customer's ability to eval- uate and integrate this information into the customer's operational environment. ABOUT THIS DOCUMENT This document details the commands for creating, verifying, and restoring a system backup. This document should only be used as a supplement to the AIX System Management Guide. Only AIX versions 3.2.5 through 4.2.0 will be discussed. Commands in this document are preceded by a prompt '#'. Other related faxes: 2769 limitation of mksysb restoration 2685 backup and restore access control lists during mksysb Why A mksysb . . . . . . . . . . . . . . . . . . . . . 1 Mksysb Disk Image . . . . . . . . . . . . . . . . . . 1 Mksysb Bootable Tape . . . . . . . . . . . . . . . . 2 Creating . . . . . . . . . . . . . . . . . . . . . . . 3 Verifying . . . . . . . . . . . . . . . . . . . . . . . 4 Restoring . . . . . . . . . . . . . . . . . . . . . . . 6 Restoring Individual Directories Or Files . . . . . . . 10 Reader's Comments . . . . . . . . . . . . . . . . . . . 12 WHY A MKSYSB The IBM AIX UNIX is different from other UNIX's for two main reasons; the ODM (object database manager) and the LVM (logical volume manager). It is because the ODM and LVM information must be recreated that a simple archive of the databases will not suffice. The mksysb script creates a bootable tape which archives rootvg, mounted jfs filesystems and rebuilds the ODM based on the "current" system config. Mksysb Disk Image A single file containing the rootvg image (as defined above) is created when a mksysb is created to a device other than a local tape drive. This image is used by NIM, SP, and other special processes which can locate, identify, and properly use this file. Backing Up The Operating System 1 11/25/96, 4FAX# 6524 Mksysb Bootable Tape 1. Images on a bootable system tape +---------------------------------------------------------+ | Bosboot | Mkinsttape | Dummy TOC | rootvg | | Image | Image | Image | data | |-----------+--------------+-------------+----------------| |<----------- Block size 512 ----------->| Blksz defined | | | by the device. | +---------------------------------------------------------+ a. The bosboot image contains a copy of your systems kernel and specific device drivers allowing you to boot from this tape. blocksize: 512 format: raw image files: kernel device drivers b. The mkinsttape image contains files to be loaded into the ram filesystem when booting in maintenance. AIX 3.2.5 blocksize: 512 format: backbyname files: ./.fs.size, ./tapeblksz, ./bosinst.data and commands AIX 4.1 & 4.2 blocksize: 512 format: backbyname files: ./image.data, ./tapeblksz, ./bosinst.data and commands c. The dummy image contains a single file containing the words "dummy toc". This image is used to make the mksysb tape contain the same number of images as a bos tape. d. The rootvg image contains data from the rootvg volume group (mounted jfs filesystems). AIX 3.2.5 blocksize: defined by ./tapeblksz file format: tar files: rootvg, mounted jfs filesystems Backing Up The Operating System 2 11/25/96, 4FAX# 6524 AIX 4.1 & 4.2 blocksize: defined by ./tapeblksz file format backbyname files: rootvg, mounted jfs filesystems CREATING A mksysb creates either a bootable tape or a non-bootable archive image. ONLY a mksysb created to a local tape drive is bootable. 1. Bootable system backup a. Using smit Fill in the correct device name to be used. Press ENTER to start the backup. If more than one tape is required, smit will prompt you to change the tape. #smit mksysb AIX 3.2.5 FORCE increase of work space if needed no Backup DEVICE or FILE {/dev/rmt#} (example: /dev/rfd0) AIX 4.1.x Backup DEVICE or FILE [/dev/rmt#] Create MAP files? no EXCLUDE files? no Make BOOTABLE backup? yes (Applies only to tape) EXPAND /tmp if needed? yes (Applies only to bootable tape) Number of BLOCKS to write in a single output [ ] (Leave blank to use a system default) AIX 4.2.x Backup DEVICE or FILE [/dev/rmt#] Create MAP files? no EXCLUDE files? no List files as they are backed up? no Generate new /image.data file? yes EXPAND /tmp if needed? yes Disable software packing of backup? no Number of BLOCKS to write in a single output [ ] (Leave blank to use a system default) b. From the command line type: AIX 3.2.5 #mkszfile && mksysb /dev/rmt# 2>/tmp/mksysb.err AIX 4.1 & 4.2 Backing Up The Operating System 3 11/25/96, 4FAX# 6524 #mksysb -i /dev/rmt# 2>/tmp/mksysb.err 2. Mksysb image file a. From SMIT A mksysb image file is created in the same manner as the bootable tape (shown above). The only differ- ence is; device or file = "/path/file" and the boot variable = "no". b. From the command line type: AIX 3.2.5 #mkszfile && mksysb /path/file 2>/tmp/mksysb.err AIX 4.1 & 4.2 #mksysb -i /path/file 2>/tmp/mksysb.err VERIFYING The ONLY method to verify that a system backup will cor- rectly restore with no problems is to actually restore the mksysb onto another machine. This should be done following your companies DISASTER RECOVERY PLAN. To minimize problems due to the tape media, you can perform a few simple tests. These tests will ONLY verify that the tape media can be read and will NOT guarantee that a mksysb will restore your system with no problems. 1. Data verification To verify the data image, list the table of contents to a file. a. Using smit AIX 3.2.5 (not applicable) AIX 4.1 & 4.2 #smit lsmksysb DEVICE or FILE [/dev/rmt#] Number of BLOCKS to read in a single input [ ] (Leave blank to use a system default) Type or select values and press Enter ONLY after selecting all values. b. From the command line type: AIX 3.2.5 #tctl -f /dev/rmt# rewind #tctl -f /dev/rmt#.1 fsf 3 #tar -tvf /dev/rmt# > /tmp/log Backing Up The Operating System 4 11/25/96, 4FAX# 6524 AIX 4.1 & 4.2 #tctl -f /dev/rmt# rewind #restore -s4 -Tvqf /dev/rmt#.1 > /tmp/mksysb.log 2. Boot verification The only way to verify that the mksysb tape will suc- cessfully boot is to bring the machine down and boot from the tape. No data needs to be restored. NOTE: To boot a keyless system in service, consult your models documentation or 4FAX #5256, "Booting in service mode at 4.1". CAUTION: Having the PROMPT variable set to "no" causes the system to begin the mksysb restore automatically using present values with no user intervention. If the state of PROMPT is unknown, this can be set during the boot process. After answering the prompt to select a console during the boot up, a rotating char- acter will be seen in the lower left of the screen. As soon as this character appears, type 000 and ENTER. This will set the prompt variable to yes. To check to a mksysb tape to see what the PROMPT vari- able is set to, follow the following steps: #tctl -f /dev/rmt0 rewind #cd/tmp #restore -s2 -xvqf /dev/rmt0.1 ./bosinst.data #vi bosinst.data To boot a mksysb tape on systems with keys follow the following steps: (For non-keyed systems, see IBM 4FAX #5256.) a. turn the key to service, b. place the mksysb tape into the drive, c. reboot the system (shutdown -Fr), d. the system should 'boot' from the mksysb tape, e. press F1 or 1 and Enter; when asked for the console, f. press 1 for English; if asked, g. if you get the main menu with no errors; ** the system has booted ** h. turn the key to normal, i. reboot the system (reset button). Backing Up The Operating System 5 11/25/96, 4FAX# 6524 RESTORING 1. Booting To boot from a mksysb, turn the key to service, place the mksysb tape in the drive, and boot the system from the tape. If the tape will not boot; remove the tape, boot from install media such as a cdrom or tape) or from bosboot diskettes (3.2 only). After booting, you will get a set of Installation and maintenance menus. If you booted from media other than the mksysb tape, you can now reinsert the tape into the tape drive. NOTE: To boot a keyless system in service, consult your model's documentation or 4FAX #5256, "Booting in service mode at 4.1". 2. Installation menus AIX 3.2.5 a. Press F1 or 1 and Enter to select this terminal as the console. You should then see "Restoring BOS installation files from tape". b. Installation and maintenance menu; select (2) 1) Install AIX 2) Install a system that was created with SMIT "Backup the System" or the "mksysb" command. 3) Install the system for use with a "/usr" server. 4) Start a limited function maintenance shell c. Current system settings; select (1) 1) INPUT Installation Device 2) DESTINATION Disks 3) STARTUP (Boot) Disks 0. Continue d. Change input device; select (# of tape), (99) DEVICE TYPE PATHNAME LOCATION CODE 1. 8mm Tape: /dev/rmt0 00-01-00-40 99. Return to previous menu e. Current system settings; select (2) Backing Up The Operating System 6 11/25/96, 4FAX# 6524 1) INPUT Installation Device 2) DESTINATION Disks 3) STARTUP (Boot) Disks 0. Continue f. Change destination hard disk(s); select (# of disk(s)),(99) Type one or more numbers for the disk(s) to be used for installation and press Enter. The current choice is indicated by >>>. To de-select a choice, type the corresponding number and press Enter. At least one bootable disk must be selected. NOTE: Be sure and know the disk(s) by SCSI ID. Hdisk#'s will not be present. LOCATION CODE SIZE (MB) VOLUME GROUP ID BOOTABLE DISK 1. 00-01-00-00 320 00032471ba62a672 YES 2. 00-01-00-10 400 00032471ba62a672 YES 99. Return to previous menu g. Current system settings; select (3) 1) INPUT Installation Device 2) DESTINATION Disks 3) STARTUP (Boot) Disks 0. Continue h. Change startup disk; select (# of disk(s)) Type one number for the disk to be used to boot and press Enter. Be sure and choose the disk by the SCSI ID. The Hdisk# will not be present. STARTUP DISK 1. 00-01-00-00 2. 00-01-00-10 i. Current system settings; select (0) 1) INPUT Installation Device 2) DESTINATION Disks 3) STARTUP (Boot) Disks 0. Continue j. Warning. All data on the selected disks will be destroyed. Do you wish to continue? Y/N (Y) AIX 4.1 & 4.2 Backing Up The Operating System 7 11/25/96, 4FAX# 6524 a. Press F1 or 1 and Enter to select this terminal as the console. b. Select a language; select (# for language) 1) Type 1 and press Enter to have English during install. c. Installation and maintenance menu; select (3) 1) Start Installation Now with Default Settings 2) Change/ Show Installation Settings and Install 3) Start Maintenance Mode for System Recovery d. Maintenance menu; select (4) 1) Access a Root Volume Group 2) Copy a System Dump to Removable Media 3) Access Advanced Maintenance Functions 4) Install from a System Backup e. Choose a Tape Drive; select (# of tape) Tape Drive Path Name 1. tape /scsi/8mm /dev/rmt0 f. Select a language - again; select (# for language) 1) Type 1 and press Enter to have English during install. g. Installation and Maintenance menu - again; select (2) 1) Start Installation Now with Default Settings 2) Change/ Show Installation Settings and Install 3) Start Maintenance Mode for System Recovery h. System Backup Installation and Settings; select (1) Setting: Current Choice(s): 1. Disk(s) where you want to install......... hdisk0 Use Maps.................................. No 2. Shrink File Systems....................... No 0. Install with the settings listed above. i. Change Disk(s) Where you want to Install; select (# of disk(s)),(0) Type one or more numbers for the disk(s) to be used for installation and press Enter. The current Backing Up The Operating System 8 11/25/96, 4FAX# 6524 choice is indicated by >>>. To de-select a choice, type the corresponding number and press Enter. At least one bootable disk must be selected. Be sure and choose the location by SCSI ID and NOT by Hdisk#. The Hdisk# value may not be the same as before the restore process. Name Location Code Size (MB) VG Status Bootable 1. hdisk0 00-01-00-0,0 305 rootvg yes 2. hdisk1 00-01-00-1,0 400 rootvg yes 0. Continue with the choices indicated above j. System Backup Installation and Settings; select 0 to continue Setting: Current Choice(s): 1. Disk(s) where you want to install......... hdisk0 2. Use Maps.................................. No 3. Shrink File Systems....................... No 0. Install with the settings listed above. 3. Turn the key to normal The system will reboot once, and you might get some error messages - ignore these mes- sages, they are normal. The system will then resync and reboot a second time and you should get a login prompt. NOTE: If you have other volume groups, you may get error messages prior to a prompt. Ignore these messages unless they prevent you from obtaining a login prompt. Total restore time varies from system to system, but a good rule of thumb is twice the amount of time it took to create the mksysb. 4. Other volume groups If you have volume groups other than rootvg you will need to import the volume group informa- tion for each vg into the new ODM (object database manager). This can be done with the following commands: #lsdev -Cc disk ; identify SCSI id to hdisk# #importvg -y vgname hdisk# ; run for each vg #varyonvg vgname ; run for each vg #shutdown -Fr ; will sync the odm and mount ; all filesystems on reboot You will need to run 'importvg' and 'varyonvg' for each of the other volume groups. When using the 'importvg' command, note that you only need ONE of the hdisks that a volume group uses. It will automatically find any other hdisks if the vg uses multiple hdisks. Also note that there is no mounting of filesystems. This function will be performed when the system is rebooted. After the system reboots, you should get a login prompt with no errors. Backing Up The Operating System 9 11/25/96, 4FAX# 6524 RESTORING INDIVIDUAL DIRECTORIES OR FILES 1. Obtain the blocksize of the tape. If the tape is not labeled with this information, then do the following: #chdev -l rmt# -a block_size=512 #tctl -f /dev/rmt# rewind #cd /tmp #restore -s2 -xvqf /dev/rmt#.1 ./tapeblksz #cat /tmp/tapeblksz 2. Setting up the tape drive #chdev -l rmt# -a block_size= {blocksize of tape} #tctl -f /dev/rmt# rewind 3. Obtain a table of contents of the rootvg image by using the following steps: a. Using smit AIX 3.2.5 (not available) AIX 4.1 & 4.2 #smit lsmksysb DEVICE or FILE [/dev/rmt#] Number of BLOCKS to read in a single input [ ] (Leave blank to use a system default) Type or select values in entry fields. Press Enter AFTER making all desired changes. b. From the command line type: AIX 3.2.5 #tctl -f /dev/rmt#.1 fsf 3 #tar -tvf /dev/rmt# > /tmp/mksysb.log AIX 4.1 & 4.2 #restore -s4 -Tvqf /dev/rmt#.1 > /tmp/mksysb.log 4. Deciding where to restore the files. The files in this image are archived relative to the root filesystems. Be sure to include the "." when selecting a directory or files to be restored. (eg. ./dir/file). To restore directories or files to their original location and overwrite existing files; #cd / Backing Up The Operating System 10 11/25/96, 4FAX# 6524 To restore directories or files to an alternative direc- tory (eg /tmp); cd to the directory. The files will be restored "relative" to this point of reference. #cd /tmp 5. Extracting directories or files Using smit type: AIX 3.2.5 (not available) AIX 4.1 & 4.2 #smit restmksysb Restore DEVICE or FILE [/dev/rmt0] FILES to restore [ ] (Leave blank to restore entire archive) Number of BLOCKS to read in a single input [ ] (Leave blank to use a system default) Type or select values in entry fields. Please Enter AFTER making all desired changes. From the command line type: AIX 3.2.5 #tctl -f /dev/rmt#.1 fsf 3 #tar -xpvf /dev/rmt# ./path/file AIX 4.1 & 4.2 #restore -s4 -xdvqf /dev/rmt#.1 ./path/file Backing Up The Operating System 11 11/25/96, 4FAX# 6524 READER'S COMMENTS Please fax this form to (512) 823-4009, attention "AIXServ Informa- tion". You may also e-mail comments to: elizabet@austin.ibm.com. These comments should include the same customer information requested below. Use this form to tell us what you think about this document. If you have found errors in it, or if you want to express your opinion about it (such as organization, subject matter, appearance) or make sug- gestions for improvement, this is the form to use. If you need technical assistance, contact your local branch office, point of sale, or 1-800-CALL-AIX (for information about support offer- ings). These services may be billable. Faxes on a variety of sub- jects may be ordered free of charge from 1-800-IBM-4FAX. Outside the U.S. call 415-855-4329 using a fax machine phone. When you send comments to IBM, you grant IBM a nonexclusive right to use or distribute your comments in any way it believes appropriate without incurring any obligation to you. NOTE: If you have a problem report or item number, supplying that number may help us determine why a procedure did or did not work in your specific situation. Problem Report or Item #: Branch Office or Customer #: Be sure to print your name and fax number below if you would like a reply: Name: Fax Number: ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ END OF DOCUMENT (mksysb.basics.bak, 4FAX# 6524) Backing Up The Operating System 12