Backing Up the Operating System in AIX 4.2 and 4.3


Contents

About this document
Why create a mksysb?
mksysb tape images
mksysb file images
Creating to a tape drive
    Creating a mksysb
    Creating to a file
Verifying
    Data verification
    Boot verification
Restoring a mksysb
Restore menus
Restoring individual files from a mksysb tape

About this document

This document details the commands for creating, verifying, and restoring a system backup in AIX Versions 4.2 and 4.3.

Why create a mksysb?

The IBM AIX UNIX differs from other UNIXs because of two main features: the Object Database Manager (ODM) and the Logical Volume Manager (LVM). Due to the ODM and the LVM, as well as the ability to have multiple volume groups, a complete system archive made with cpio or tar will not restore properly. Attempting to restore such an archive on a running system can potentially crash the machine. Creating a mksysb to a tape drive will create a bootable tape that will allow the system's ODM and LVM to be restored properly.


mksysb tape images

There will be four images on the mksysb tape, and the fourth image will contain only rootvg JFS mounted file systems. The target tape drive must be local to create a bootable tape.

The following is a description of mksysb's four images.

  +---------------------------------------------------------+ 
  |  Bosboot  |  Mkinsttape  |  Dummy TOC  |    rootvg      | 
  |   Image   |     Image    |    Image    |     data       | 
  |-----------+--------------+-------------+----------------| 
  |<----------- Block size 512 ----------->| Blksz defined  | 
  |                                        | by the device  | 
  +---------------------------------------------------------+ 

Image #1: The bosboot image contains a copy of the system's kernel and specific device drivers, allowing the user to boot from this tape.

    blocksize:              512 
    format:                 raw image 
    files:                  kernel device drivers 

Image #2: The mkinsttape image contains files to be loaded into the RAM file system when you are booting in maintenance.

    blocksize:              512 
    format:                 backbyname 
    files:                  ./image.data, ./tapeblksz, 
                            ./bosinst.data and commands 

Image #3: 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 Install tape.

Image #4: The rootvg image contains data from the rootvg volume group (mounted JFS file systems only).

    blocksize:              determined by tape drive configuration 
                            on create 
    format:                 backbyname 
    files:                  rootvg, mounted JFS filesystems 

WARNING: If the device blocksize is set to 0, mksysb will use a hardcoded value of 512 for the fourth image. This can cause the create and restore to take 5-10 times longer than expected.


mksysb file images

Creating a mksysb to a file will create a non-bootable, single-image backup and restore archive containing only rootvg JFS mounted file systems.


Creating to a tape drive

NOTE: A mksysb tape is only bootable when it is created to a tape drive.

  1. Using SMIT

    1. Execute the following command:
      		smit mksysb 
      
      A dialog box will appear.

    2. 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 the user to change the tape.
          smit mksysb 
          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) 
      

  2. Execute the following command:
        mksysb -i /dev/rmt# 2>/tmp/mksysb.err 
    

WARNING: If the device blocksize is set to 0, mksysb will use a hardcoded value of 512 for the fourth image. This can cause the create and restore to take 5-10 times longer than expected.

Creating a mksysb

  1. The file system /tmp must have at least 12MB free prior to creating the mksysb.

  2. Note how many volume groups the system has, what disks they are located on, and the location of each disk. hdisk#s are not retained.
        lsvg 
        lsvg -p <vgname> 
        lsdev -Cc disk 
    

Creating to a file

  1. Using SMIT

    A mksysb image file is created in the same manner as the bootable tape (shown in previous portion of this section). The only difference is shown in the second line of the dialog box:

    1. Execute the following command:
          smit mksysb 
      
    2. A dialog box will appear. Make the appropriate selections.
      Backup DEVICE or FILE                          [/path/file] 
      Number of BLOCKS to write in a single output   [ ] 
                 (Leave blank to use a system default) 
      
  2. Execute the following command:
        mksysb -i /path/file 2>/tmp/mksysb.err 
    

Verifying

The only method to verify that a system backup will correctly restore with no problems is to actually restore the mksysb onto another machine. This should be done following each individual company's DISASTER RECOVERY PLAN.

To minimize problems due to tape media damage, perform the following tests.

WARNING: These tests only verify that the tape media can be read and will not guarantee that a mksysb will be restored successfully.

Data verification

  1. Using SMIT

    1. Execute the following command:
          smit lsmksysb 
      
      A dialog box will appear.
      DEVICE or FILE                               [/dev/rmt#] 
      Number of BLOCKS to read in a single input   [ ] 
               (Leave blank to use a system default) 
      

    2. Type or select values and press enter only after making the desired changes.

  2. Execute the following commands:
        tctl -f /dev/rmt# rewind 
        restore -s4 -Tvqf /dev/rmt#.1 > /tmp/mksysb.log 
    

Boot verification

The only way to verify that the mksysb tape will successfully boot is to bring the machine down and boot from the tape. No data needs to be restored.

NOTE: To boot a keyless system or a system with multiprocessors in Service mode, consult the model's documentation or contact your AIX support representative for assistance.

WARNING: Having the PROMPT field in the bosint.data file set to no causes the system to begin the mksysb restore automatically using preset values with no user intervention.

If the state of PROMPT is unknown, it can be set during the boot process. After answering the prompt to select a console during the startup process, a rotating character will be seen in the lower left of the screen. As soon as this character appears, type 000 and press Enter. This will set the prompt variable to yes.

  1. Check PROMPT.

    To check a mksysb tape to see how the PROMPT is set, run the following while in Normal mode:

        chdev -l rmt# -a block_size=512 
        tctl -f /dev/rmt# rewind 
        cd /tmp 
        restore -s2 -xvqf /dev/rmt#.1 ./bosinst.data 
        Check the PROMPT field in the control_flow stanza. 
    
  2. Boot in SERVICE mode.

    1. If the system has a key, turn it to Service. If the system is keyless, consult the model's documentation or contact your AIX support representative for assistance.
    2. Insert the mksysb tape into the tape drive.
    3. Execute the following command to reboot the system:
      			shutdown -Fr 
      
  3. The system should now "boot" from the mksysb tape.

    NOTE: Multiprocessor systems display a Maintenance Menu called a BUMP MENU. This is a hardware menu. For more information, consult the model's documentation or contact your AIX support representative for assistance.

  4. The message press F1 or 1 for Console should appear. Press the F1 key for a graphics display or the 1 key for an ASCII display, and press Enter.

  5. Press 1 for English, if asked.

  6. The Installation and Maintenance menu should display. The system has booted successfully.

  7. Turn the key to normal, or follow the non-key instructions for rebooting into normal mode, and REBOOT the system.

Restoring a mksysb

Be sure to select all physical volumes required for the root volume group. This is especially important if there is mirroring. Mirrored disks must be selected at the time of installation or an error like the following will be seen:

    not enough physical volumes.
  1. Boot in SERVICE mode.

    1. If the system has a key, turn it to Service. If the system is keyless, consult the model's documentation or contact your AIX support representative for assistance.

    2. Insert the mksysb tape into the tape drive.

    3. Reboot the system by running the command shutdown -Fr or by pressing the Reset button twice.

  2. The system should now "boot" from the mksysb tape.

    If the system will not boot, remove the mksysb tape and boot from install media such as a CD-ROM or tape.

    NOTE: Multiprocessor systems display a Maintenance Menu called a BUMP MENU. This is a hardware menu. For more information, consult the model's documentation or contact your AIX support center for assistance.

  3. Next, at the message stating press F1 or 1 for Console, press the F1 key for a graphics display (or 1 for an ASCII display), and press Enter.

  4. Press 1 for English, if asked.

  5. The Installation and Maintenance menu should appear. If the system was booted from media other than the mksysb tape, the tape can now be inserted into the tape drive. Follow the steps listed in the following section, Restore menus.

  6. After the restore is complete, turn the key to Normal. If the system is keyless, this is automatic.

  7. The system will reboot once. The system displays events from inittab, and a login prompt appears.

    NOTE: If the system has volume groups other than rootvg, there may be error messages prior to a login prompt. Ignore these messages unless they prevent you from obtaining the prompt.

    NOTE: Total restore time varies from system to system. A good rule of thumb, providing the device blocksize is not set to 0, is twice the amount of time it took to create the mksysb. If the blocksize of the source tape drive was 0, the mksysb would have been created with a blocksize of 512. In this case, the restore time will be 5-10 times longer than normal.

  8. If there are other disks that contain other volume groups, they will need to be imported into the newly created ODM. No references to the other volume groups exist prior to this step.

    1. Match the newly labeled hdisk#s to the appropriate SCSI location IDs. Do not assume that the hdisks will be at the same location. The disks are renumbered from lowest to highest location number and labeled accordingly.

      Enter:

          lsdev -Cc disk 
      
    2. Import each volume group into the new ODM. The following must be run for each non-rootvg volume group. However, only one disk per volume group need be selected.
          importvg -y <vgname> hdisk# 
      

      For example, if there is another vg named "data" and it resides on hdisk3 and hdisk4, enter:

          importvg -y data hdisk3 
      
    3. Activate each non-root volume group by entering:
          varyonvg <vgname> 
      
    4. Restart the system to resync the ODM and mount all file systems. Enter:
          shutdown -Fr 
      

      NOTE: If the system is not to be rebooted again, use mount -a in place of shutdown. This will mount all the new file systems. However, a system reboot should be scheduled as soon as possible to be sure that everything is in sync.

    5. A login prompt should now be displayed.

Restore menus

  1. From the 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 
    
  2. From the 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 
    
  3. Choose a Tape Drive select (# of tape):
           Tape Drive              Path Name 
        1. tape /scsi/8mm         /dev/rmt# 
    
  4. Select a language, if asked (# for language):
        1)  Type 1 and press Enter to have English during the install. 
    
  5. You will return to the Installation and Maintenance Menu. Now select (2):
        1)  Start Installation Now with Default Settings 
        2)  Change/Show Installation Settings and Install 
        3)  Start Maintenance Mode for System Recovery 
    
  6. From the 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. 
    
  7. Change Disk(s) Where You Want to Install (give # of disks). Then select (0).

    Type one or more numbers for the disks to be used for installation and press Enter. The current choice is indicated by >>>. To deselect a choice, type the corresponding number and press Enter. At least one bootable disk must be selected. Choose the location by its SCSI ID.

           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 
    
  8. To shrink the file systems to reclaim free space allocated to the file systems, select option 2 so the setting is set to Yes. For the file systems to be restored with the same allocated space as the original system, make sure option 2 is set to No.

  9. 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. 
    
  10. The following message will appear:
    WARNING: All data on the selected disks will be destroyed.  Do you 
    wish to continue?  "Y/N" 
    
    Select Y.

Restoring individual files from a mksysb tape

  1. To restore individual files or directories from a mksysb tape, find out the blocksize of the fourth image. To obtain this information, run the following commands:
        cd /tmp 
        tctl -f /dev/rmt# rewind (# to be replaced by a number) 
        chdev -l rmt# -a block_size=512 
        restore -s2 -xqdvf /dev/rmt#.1 ./tapeblksz 
        cat ./tapeblksz 
    

    The output that is given is the blocksize to which the tape drive was set when the mksysb was made.

  2. Next, set the blocksize of the tape drive accordingly by running the following command:
        chdev -l rmt# -a block_size=[number in the 
        ./tapeblksz file] 
    

  3. Restore the files or directories by running the following commands:
        cd /  (if the file is to be restored to its original place) 
        tctl -f /dev/rmt# rewind 
        restore -s4 -xqdvf /dev/rmt#.1 ./dir/filename (for one file) 
    

    OR

        restore -s4 -xqdvf /dev/rmt#.1 ./dir  (for all files in dir) 
    



[ Doc Ref: 90605209714762     Publish Date: Spt. 07, 2000     4FAX Ref: 8166 ]