13.2. Backing Up with mksysbmksysb has several options, which are described in this section. First, you can back up and restore from a locally attached tape. You can also back up to a remote tape drive, but you must restore from a locally attached tape drive. Next, you can use mksysb to make a system backup on disk, such as a centrally located NFS filesystem. If you do that, you have two recovery choices. The first choice is to create bootable DVDs/CDs using mkcd and then boot from those during a recovery. The second recovery choice is to boot from a NIM and restore directly from the NFS-mounted image. Finally, you can also create DVDs/CDs directly using mkcd. Let's take a look at these options. 13.2.1. mksysb SummaryHere is a quick summary of the options of mksysb that I'll be using in this section:
13.2.2. Backing Up rootvg to Locally Attached TapeThe simplest scenario is to back up all filesystems in rootvg with a locally attached tape drive. In this situation, issue the following command from a root prompt: # mksysb -i /dev/rmt0 The difference between the various ways to access a tape device on AIX systems is illustrated in Table 13-1 and explained in detail in the manpages.
This can also be achieved through the System Management Interface Tool (smit) menus, of course, and the following fast path brings you directly to the correct screen: # smit mksysb You should be able to use any locally attached tape drive supported by AIX. 13.2.3. Backing Up rootvg to a Remote Tape DriveYou can perform a mksysb directly to a remote tape by following this procedure. For the purpose of this example, consider two machines:
First, make sure the /.rhosts or /etc/hosts.equiv file is set up properly on both machines to allow rsh from the client to the tapeserver. On the tapeserver, use this procedure to manually create a mksysb image:
Now that we have the bootable part of the tape (i.e., the boot block), the installation files, and the dummy table of contents, we need to transfer the data. On the client, run mkszfile , and create a file called /etc/exclude.vg that contains only /tmp/mksysb. pipe. Then, direct mksysb to a named pipe. Finally, cat the contents of the pipe to the tapeserver's tape drive:
If you are lazy, a script written by Henk van Doorn called rmksysb does all of this. 13.2.4. Backing Up to DiskIt is possible to back up a system to a locally attached disk, but that obviously presents challenges during a restore. It's even possible to back up the rootvg to a file in the rootvg, but that would really be a bad idea for a few different reasons. A common practice is therefore to set up a NFS share on a separate server to hold mksysb backups. The filesystem must be large-file-enabled, and you must set ulimit to allow 9 GB files (by default, ulimit is set to 1 GB). To see the current setting of ulimit: Client # ulimit f 2097151 The systemwide default setting is configured in /etc/security/limits. You can also change it in a shell using the ulimit command (9 GB plus a little for overhead): Client # ulimit f 19000000 Now that we can write out a large file (over 1 GB), we can write a backup of the rootvg to an NFS mount on the client system. In the following examples, we use / NFS_mount/mksysb from the server NFS_Server to hold mksysb backups. We'll use the command mksysb e m /directory/filename. The e option tells it to exclude patterns listed in / etc/exclude.rootvg, and the m option specifies the media to write to. The last argument should be the full pathname of the file in which to store the image. Client # mksysb e m /NFS_mount/mksysb/client-6-1-06.msb_image Creating information file (/image.data) for rootvg.. Creating list of files to back up. Backing up 39932 files..........# # 39932 of 39932 files (100%) 0512-038 mksysb: Backup Completed Successfully. It's just that easy to make a backup of the rootvg. We now have a backup that we can restore to this host. In the event of a minor problem, we can restore a single file, and in the event of a major problem, we can create a bootable restore DVD or restore using NIM. 13.2.5. Making a Bootable DVD/CD from an Existing mksysbOnce you create a mksysb image on disk, you can use it to create a set of bootable DVDs or CDs that can be used to restore the system very quickly. This process has three steps:
We are going to need some local scratch space for the first two steps. This scratch space should not be in rootvg and needs to have enough space to hold the temporary CD/DVD filesystem and the CD/DVD ISO images. For each CD, this is about 645 MB, and each DVD holds 4.38 GB. The temporary files can probably be on an NFS directory, but it's probably best if the ISO images are stored locally to prevent buffering problems when creating the DVDs or CDs. We'll use the following arguments to the mkcd command to perform this task:
In the following examples, the host named NFS_Server has a DVD writer. It also has a local 18 GB filesystem called /mkcd that we use for both the temporary images as well as the ISO images. NFS_Server also shares the filesystem /NFS_Share/mksysb with other clients so they can write their mksysb backups there. (This is the same directory we backed up to in the previous example.) The example that follows uses the NFS server to create a bootable CD image from the mksysb image we created on the NFS mount in the previous example (/NFS_share/mksysb/client-6-1-06.msb_image). We use the directory /mkcd/cd_fs to hold the temporary images and the directory /mkcd/cd_images to hold the final ISO images. NFS_Server # mkcd -m /NFS_share/mksysb/client-6-1-06.msb_image -C /mkcd/cd_fs -I /mkcd/cd_images -R S Initializing mkcd log: /var/adm/ras/mkcd.log... Verifying command parameters... Populating the CD or DVD file system... Copying backup to the CD or DVD file system... . Building chrp boot image... Creating Rock Ridge format image: /mkcd/cd_images/cd_image_295108.vol1 Running mkisofs ... . mkrr_fs was successful. Making the CD or DVD image bootable... Copying the remainder of the backup to the CD or DVD file system... Creating Rock Ridge format image: /mkcd/cd_images/cd_image_295108.vol2 Running mkisofs ... . mkrr_fs was successful. Copying the remainder of the backup to the CD or DVD file system... Creating Rock Ridge format image: /mkcd/cd_images/cd_image_295108.vol3 Running mkisofs ... . mkrr_fs was successful. This gives us three ISO CD images in /mkcd/cd_images. The temporary data that was copied to /mkcd/cd_fs was removed after the cd image was created. We can now transfer that image to another server with a CD drive and burn the .ISO images. If we want to create a DVD image, we add the L flag to the command: NFS_Server # mkcd L -m /NFS_share/mksysb/client-6-1-06.msb_image -C /mkcd/cd_fs -I /mkcd/cd_images -R S Initializing mkcd log: /var/adm/ras/mkcd.log... Verifying command parameters... Populating the CD or DVD file system... Copying backup to the CD or DVD file system... ....... Building chrp boot image... Creating Rock Ridge format image: /mkcd/cd_images/cd_image_405642 Running mkisofs ... ........ mkrr_fs was successful. Making the CD or DVD image bootable... Our earlier example created three ISO images of CD size, but in this example, we specified the L flag, so we have one large DVD ISO image. You can use these ISO images to create a CD or DVD on any host. If you want to create the images and burn the CD/DVD all in one step, you can drop the S and R options and add the d option, followed by the device name of the CD/DVD burner: NFS_Server # mkcd d /dev/cd0 e -m /NFS_share/mksysb/client-6-1-06.msb_image -C /mkcd/cd_fs -I /mkcd/cd_images If you want to burn a CD from an ISO image created earlier, use a command like this: NFS_Server # burn_cd /dev/cd0 /NFS_share/mksysb/client-6-1-06.msb_image If there is more than one CD image file, repeat the command for each image file. If you want to burn a DVD from an ISO image, add the d flag: NFS_Server # burn_cd d /dev/cd0 /NFS_share/mksysb/client-6-1-06.msb_image 13.2.6. Creating a CD/DVD Backup in One StepIf you are lucky enough to have a CD/DVD writer available on the system you want to make DVDs for and have sufficient local scratch space to build a CD image, you can use mkcd to create the CD/DVD in one step. Although all of the steps in the previous method are still required and performed, mkcd manages and automates the whole process, from making the mksysb backup all the way to burning the actual DVDs/CDs. In the following example, we want to make a bootable DVD-sized backup of the rootvg with map files (restore LVM), excluding all files and directives in /etc/exclude.rootvg: NFS_Server # mkcd -L -P e M /NFS_Share/mksysb C /mkcd/cd_fs I /mkcd/cd_images -R S Initializing mkcd log: /var/adm/ras/mkcd.log... Verifying command parameters... Creating image.data file... Creating mksysb image... Creating list of files to back up. Backing up 39945 files............... 39945 of 39945 files (100%) 0512-038 mksysb: Backup Completed Successfully. Populating the CD or DVD file system... Copying backup to the CD or DVD file system... ....... Building chrp boot image... Creating Rock Ridge format image: /mkcd/cd_images/cd_image_323664 Running mkisofs ... .... mkrr_fs was successful. Making the CD or DVD image bootable... NFS_Server # This command performs a mksysb of the rootvg and from that makes a bootable DVD ISO image in /mkcd/cd_images called cd_image_323664. You can either transfer that image to another system (including a PC with a DVD burner) and make a DVD from it, or make a DVD on the local system using the d device argument to mkcd. If you want to make CD images, just issue the same command without the L flag. It then produces multiple CD images if the backup is larger than one CD. |