mksysb Command

Purpose

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

Syntax

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

Description

The mksysb command creates a backup of the operating system that is know as the root volume group (rootvg). You can use the backup that is created by the mksysb command to reinstall an operating system to its original state if the system is corrupted. If you create the backup on a tape or on a user-defined file system (UDFS) capable media, the backup is bootable. The backup includes the installation programs that are needed to install from the backup.

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

You can use a mksysb image to restore another system.

The file system image is in a 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 rootvg image is in a backup-file format, starting with the data files and optional map files.

One of the data files that the mksysb command uses is the /bosinst.data data file. If the /bosinst.data file does not exist, the /var/adm/ras/bosinst.data file is copied to the root (/). The mksysb command updates the target_disk_data stanzas in the bosinst.data file to match the disks that are in the root volume group of the system where the mksysb command runs.

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

Notes:
  1. Make sure that the system activity is minimal when you run the mksysb command.
  2. The image that the mksysb command creates does not include data on raw devices or the data in the user-defined paging spaces.
  3. If you use 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 the device configurations of the special features such as /dev/netbios file and the device drivers that are not shipped with the product.
  5. The mksysb command by using the backup command creates an archive image. The mksysb command saves the extended attributes (EA) format for any enhanced Journaled File System (JFS2) that is backed up. It uses the /usr/bin/mkszfile shell script to save the information.
  6. If you remove the /dev/ipldevice file before you run the mksysb command, the 0301-150 bosboot error occurs. You can ignore this message. The return code confirms the success of the mksysb command.
  7. Use the -Z flag to create a tape backup and have encrypted file systems. You cannot reinstall your system from a tape backup image that contains the encrypted file systems.

To create a backup of the operating system to a CD, see mkcd command. To create a backup of the operating system to a DVD, see mkdvd command.

Flags

Item Description
-a Does not back up extended attributes or Network File System version 4 (NFS4) access control lists (ACLs).
-A Backs up Data Management API (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 a tape device, the default is 100 blocks for backups.

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

-C Specifies whether the /usr/lpp/bos.alt_disk_install/boot_images/bosboot.disk.chrp boot image can be replaced with a new boot image when you create the mksysb image.
Use the -C flag if the interim fixes that affect the kernel are installed on your system and if you want to use the alt_disk_mksysb command to install the mksysb image. The bos.alt_disk_install.boot_images fileset must be installed on your system if you want to use the –C flag. You must specify the –i flag to build a new image.data file when using the –C flag. The new bosboot.disk.chrp image is replaced by the original image at the end of the mksysb image creation. The -C flag is not available when you create the mksysb image when defining a NIM resource. A multibos Base Operating System (BOS) standby instance is not affected by the -C flag.
Note: You can increase the size of the /usr file system to include the new boot image by using the -X flag with the -C flag.
-e Excludes the files that are listed in the /etc/exclude.rootvg file from back 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. 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 are excluded from the backup. If you want to exclude files that are listed in the /etc/exclude.rootvg file, select the Exclude Files field and press the Tab key to change the default value to yes.

For example:
  1. To exclude all the contents of the directory that is known as scratch, edit the exclude file to read as follows:
    /scratch/
  2. To exclude the contents of the directory that is known as /tmp, and to avoid excluding any other directories that contain the /tmp directory in the path name, edit the exclude file to read as follows:
    ^./tmp/
    This excludes all contents of the /tmp directory, but the /tmp mount point for the file system is retained. It does not remove other directories or its contents such as /var, /adm, /sw, and the /tmp file system.
The files related to the current working directory (.) are backed up. 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 the dot character (.), followed by the file name or the directory to be excluded.

If the file name or the directory that is excluded is a substring of another file name or directory, you must use the caret character followed by a dot character (^.). This indicates that the search must begin at the beginning of the line.

To indicate that the search must end at the end of the line, you must use the dollar sign character ($).

-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. The -F flag must be used with a tape device.
-G Excludes WPAR file systems from the system backup. The -G flag is not valid with the -N flag.
-i Calls the mkszfile command, which generates the /image.data file. The /image.data file contains the details of volume groups, logical volumes, file systems, paging space, and the physical volumes. This information is included in the backup for future use by the installation process.

If you do not use the -i flag, an older /image.data file might be saved that does not contain adequate space requirements to restore the system backup.

Note: Before you run the mkszfile command, ensure that there is enough space in the /tmp file to store a boot image. The space in the /tmp file is needed during the backup and installation process. To determine the amount of space that is needed in the /tmp file, enter the following command:
bosboot -q -a -d device
If you are using a UDFS capable device that is named /dev/usbms0 file, you must specify the /dev/cd0 file as the device name because the /dev/usbms0 device is not supported by the bosboot command. 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 the map files.
Note: You must use the -m flag to run the functions of the -i flag.
-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. Install the bos.alt_disk_install.boot_images fileset at the system level.
-N Includes the file systems that belong to a workload partition (WPAR) in a defined state in the system backup.
Note: To include the filesystem in the backup, the file systems that belong to a WPAR in the defined state must be in the rootvg volume group.
-p Disables the 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, /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 command backup, you must edit the /etc/exclude_packing.type file to add on consecutive lines /etc/filesystems and /usr/bin/zcat.

In this case, the file /etc/exclude_packing.type file must be as follows:
/etc/filesystems
/usr/bin/zcat

The -P flag and the -p flag are mutually exclusive.

-t argument Specifies the path to the directory or file system that is used to create a boot image from the mksysb file that is 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.
-T Creates rootvg backup by using the snapshots. This command applies only to JFS2 file systems.

When you specify the -T flag to use snapshots for creating a volume group backup, external JFS2 snapshots are created. Snapshots allow for a point-in-time image of a JFS2 file system and do not require a system to be put into a temporarily inactive state. The size of the snapshot is 2% to 15% of the size of the file system. The snapshot logical volumes are removed when the backup is complete. However, snapshots are not removed if a file system already has other snapshots. If a file system has internal snapshots, external snapshots cannot be created and snapshots are not used for creating the backup of the file system. The use of the -T flag does not affect any JFS file systems that are present in the volume group that is being backed up. These file systems are backed up in the same manner as done previously.

When you specify the -T flag, you must also specify the -i flag. If you do not specify the -i flag, an older /image.data file might not have adequate space requirements. Therefore, a failure might occur when you save the data to the snapshot.

-v Verbose mode. Lists files as they are backed up.
-V Verifies a tape backup. The -V 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 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.
-X Specifies to automatically expand the /tmp file system if necessary. The /tmp file system might 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 the file systems are not backed up.
Attention: Use the -x flag with caution when you exclude the file systems from the backup of the operating system. The resulting backup might 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 command is a link to the mksysb command.
3 An error occurred before any file systems were mounted.
4 Exit because of a trap.
5 Exit, as there was no space.
6 Exit, as the volume group name was not valid.

Examples

  1. To generate a system backup and create an /image.data file that is generated by the mkszfile command to a tape device that is named as /dev/rmt0 file, enter the following command:
    mksysb -i /dev/rmt0
  2. To generate a system backup and create an /image.data file with map files that is generated by the mkszfile command to a tape device that is named as /dev/rmt1 file, 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 the /home/user1/tmp directory, create the /etc/exclude.rootvg file that contains the /home/user1/tmp/ line, and enter the following command:
    mksysb -i -e /dev/rmt1
    This command backs up the /home/user1/tmp directory but not the files that it contains.
  4. To generate a system backup file that is named as /mksysb_images/node1 file and a new /image.data file for that image, enter the following command:
    mksysb -i /mksysb_images/node1
    Note: This file is not bootable and can be installed only by using the Network Installation Management (NIM).
  5. After you run the mkszfile command independently to generate a system backup on the tape device /dev/rmt0, and to verify the readability of file headers, enter the following command:
    mksysb  /dev/rmt0 -V
  6. To generate a system backup file that is named as /mksysb_images/mksysb1 file to be used with the multibos command, and to create an /image.data file for that image, enter the following command:
    mksysb -iM /mksysb_images/mksysb1
  7. To generate a system backup and create an /image.data file that is generated by the mkszfile command, to a UDFS capable device that is named as /dev/usbms0 file, enter the following command:
    mksysb -i /dev/usbms0
    Note: For more information about backing up a volume group, see listvgbackup command. To restore individual files from a volume group backup, see restorevgfiles command.

Files

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