mksysb Command

Purpose

Creates an installable image of the root volume group either in a file or onto a bootable tape.

Syntax

mksysb [ -a ] [ -A ] [ -b number ] [ -e ] [ -F filename ] [ -i ] [ -m ] [ -p ] [ -t argument ] [ -v ] [ -V ] [-x file ] [ -X ] [-Z] [ -G | -N ] [-M] device | file

Description

The mksysb command creates a backup of the operating system (that is, the root volume group). You can use this backup to reinstall a system to its original state if it is corrupted. If you create the backup on tape or UDFS capable media, the backup is bootable and includes the installation programs needed to install from the backup.

Note: If the system has a multibos environment where both instances are mounted, you can restore the backup only by using the alt_disk_mksysb command.

You can also use a mksysb image to restore another system. For more information about restoring another system, see Cloning a system backup.

The file-system image is in backup-file format. The tape format includes a boot image, a bosinstall image, and an empty table of contents followed by the system backup (root volume group) image. The root volume group image is in backup-file format, starting with the data files and then any optional map files.

One of the data files mksysb uses is the /bosinst.data file. If a /bosinst.data file does not exist, /var/adm/ras/bosinst.data is copied to / (root). In AIX® 4.3.3 and later versions, mksysb always updates the target_disk_data stanzas in bosinst.data to match the disks currently in the root volume group of the system where the mksysb command is running.

If you are using a customized /bosinst.data file and do not want the target_disk_data stanzas updated, you must create the file /save_bosinst.data_file. The mksysb command does not update /bosinst.data if the /save_bosinst.data_file exists.

Note:
  1. While the mksysb command is running, ensure that system activity is minimal.
  2. The image that the mksysb command creates does not include data on raw devices or in user-defined paging spaces.
  3. If you are using a system with a remote-mounted /usr file system, you cannot reinstall your system from a backup image.
  4. The mksysb command might not restore all device configurations for special features, such as /dev/netbios and some device drivers not shipped with the product.
  5. Some rspc systems for AIX 5.1 and earlier do not support booting from tape. When you make a bootable mksysb image on an rspc system for AIX 5.1 and earlier that does not support booting from tape, the mksysb command issues a warning indicating that the tape will not be bootable. You can install a mksysb image from a system that does not support booting from tape by booting from a CD and entering maintenance mode. In maintenance mode, you can install the system backup from tape.
  6. The mksysb command uses the backup command to create its archive image. The mksysb command also saves the EA format for any JFS2 file systems being backed up. It uses the /usr/bin/mkvgdata shell script to save this information.
  7. If you remove the /dev/ipldevice prior to executing the mksysb command, the 0301-150 bosboot error occurs. This message, in most cases, can be ignored. Confirm the success of the mksysb command by the return code.

To create a backup of the operating system to CD, please refer to the mkcd command.

Flags

Item Description
-a Does not back up extended attributes or NFS4 ACLs.
-A Backs up DMAPI file system files.
-b number Specifies the number of 512 - byte blocks to write in a single output operation. When the backup command writes to tape devices, the default is 100 for backups by name.

The write size is the number of blocks multiplied by the block size. The default write size for the backup command writing to tape devices is 51200 (100 * 512) for backups by name. The write size must be an even multiple of the tape's physical block size.

-e Excludes files listed in the /etc/exclude.rootvg file from being backed up. The rules for exclusion follow the pattern matching rules of the grep command.

If you want to exclude certain files from the backup, create the /etc/exclude.rootvg file, with an ASCII editor, and enter the patterns of file names that you do not want included in your system backup image. The patterns in this file are input to the pattern matching conventions of the grep command to determine which files will be excluded from the backup. If you want to exclude files listed in the /etc/exclude.rootvg file, select the Exclude Files field and press the Tab key once to change the default value to yes.

For example:
  1. To exclude all the contents of the directory called scratch, edit the exclude file to read as follows:
         /scratch/
  2. To exclude the contents of the directory called /tmp, and avoid excluding any other directories that have /tmp in the path name, edit the exclude file to read as follows:
         ^./tmp/

All files are backed up relative to . (current working directory). To exclude any file or directory for which it is important to have the search match the string at the beginning of the line, use the ^ (caret character) as the first character in the search string, followed by . (dot character), followed by the filename or directory to be excluded.

If the filename or directory being excluded is a substring of another filename or directory, use the ^. (caret character followed by dot character) to indicate that the search should begin at the beginning of the line and use the $ (dollar sign character) to indicate that the search should end at the end of the line.

-F filename Specifies a previously created mksysb image from which a backup tape is created. An attempt is made to make the backup tape bootable. Additionally, this flag must be used with a tape device.
-i Calls the mkszfile command, which generates the /image.data file. The /image.data file contains details about volume groups, logical volumes, file systems, paging space, and physical volumes. This information is included in the backup for future use by the installation process.
Note: Before running the mkszfile command, ensure that enough space is available in the /tmp file to store a boot image. This space is needed during both backup and installation. To determine the amount of space needed in the /tmp file, issue the following command:
bosboot -q -a -d device
If you use the -X flag with the mksysb command, you do not need to run the bosboot command to determine the amount of space needed in the /tmp file.
-m Calls the mkszfile command, with the -m flag to generate map files.
Note: The use of the -m flag causes the functions of the -i flag to be executed also.
-M Creates a backup file that is intended for use with the multibos command. The -M flag backs up the /, /usr, /var, and /opt file systems. Do not use the backup to reinstall a system. You must install the bos.alt_disk_install.boot_images file set at the same level as the system.
-N Includes file systems that belong to a workload partition (WPAR) in the defined state in the system backup.
Note: To be included in the backup, all file systems that belong to a WPAR in the defined state need to be in the rootvg volume group.
-p Disables software packing of the files as they are backed up. Some tape drives use their own packing or compression algorithms.
- P Excludes files that are listed line by line in the /etc/exclude_packing.rootvg , or /etc/exclude_packing.vgname , or /etc/exclude_packing.WPARname file from being packed. For example, to exclude the /etc/filesystems and /usr/bin/zcat file from being packed during the mksysb backup, edit the /etc/exclude_packing.<type> to add on consecutive lines /etc/filesystems and /usr/bin/zcat.
Example:
  • File /etc/exclude_packing.<type> will be
    /etc/filesystems
    /usr/bin/zcat

The -P and -p flags are mutually exclusive.

-t argument Specifies the path to the directory or file system used to create a boot image from the mksysb file specified by the -F flag. If the -t flag is not used with the -F flag, the boot image is created in the /tmp file by default. Approximately 100 MB of free space is required. After the boot image is created, this space is freed.
-v Verbose mode. Lists files as they are backed up.
-V Verifies a tape backup. This flag causes the mksysb command to verify the file header of each file on the backup tape and report any read errors as they occur.
-X Specifies to automatically expand the /tmp file system if necessary. The /tmp file system may need to be extended to make room for the boot image when creating a bootable backup to tape.
-Z Specifies that the Encrypted File System (EFS) information for all the files, directories, and file systems is not backed up.
-G Excludes WPAR file systems from the system backup. This flag is not valid with -N flag.
-x file Excludes the file systems that are listed in the file from the system backup. File system mount points must be listed one per line.
Note: Use care when excluding file systems as a resulting backup can be unusable for system restoration.

Parameters

Item Description
Device | File Specifies the name of the device or file.

Exit Status

This command returns the following exit values:
Item Description
0 The command completed successfully.
1 An error in the mksysb command use occurred.
2 An error in the savevg command use occurred. The savevg is a link to mksysb.
3 An error occurred before any file systems were mounted.
4 Exit because of trap.
5 Exit because there was no space.
6 Exit because a volume group name was not valid.

Examples

  1. To generate a system backup and create an /image.data file (generated by the mkszfile command) to a tape device named /dev/rmt0, enter the following command:
    mksysb -i /dev/rmt0
  2. To generate a system backup and create an /image.data file with map files (generated by the mkszfile command) to a tape device named /dev/rmt1, enter the following command:
    mksysb -m /dev/rmt1
  3. To generate a system backup with a new /image.data file, but exclude the files in directory /home/user1/tmp, create the file /etc/exclude.rootvg containing the line /home/user1/tmp/, and enter the following command:
    mksysb -i -e /dev/rmt1
    This command backs up the /home/user1/tmp directory but not the files it contains.
  4. To generate a system backup file named /mksysb_images/node1 and a new /image.data file for that image, enter the following command:
    mksysb -i /mksysb_images/node1
    Note: This file will not be bootable and can only be installed using Network Installation Management (NIM).
  5. To generate a system backup on the tape in /dev/rmt0, and then verify the readability of file headers, enter the following command:
    mksysb  /dev/rmt0 -V
  6. To generate a system backup file named /mksysb_images/mksysb1 to be used with the multibos command, enter the following command:
    mksysb -M /mksysb_images/mksysb1
  7. To generate a system backup and create an /image.data file (generated by the mkszfile command) to a UDFS capable device named /dev/usbms0, enter the following command:
    mksysb –i /dev/usbms0

Files

Item Description
/usr/bin/mksysb Contains the mksysb command.