Section 13.2. Backing Up with mksysb


13.2. Backing Up with mksysb

mksysb 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 Summary

Here is a quick summary of the options of mksysb that I'll be using in this section:


-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.


-i

Calls the mkszfile command, which generates the /image.data file. The /image. data file contains information on volume groups, logical volumes, filesystems, paging space, and physical volumes. This information is included in the backup for future use by the installation process.


-m

Calls the mkszfile command with the -m flag to generate map files. (Using the -m flag causes the functions of the i flag to be executed also.)

13.2.2. Backing Up rootvg to Locally Attached Tape

The 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.

Table 13-1. AIX device-naming conventions
Device nameDensityRewind on closeRetention on open
/dev/rmt* Setting #1YesNo
/dev/rmt*.1 Setting #1NoNo
/dev/rmt*.2 Setting #1YesYes
/dev/rmt*.3 Setting #1NoYes
/dev/rmt*.4 Setting #2YesNo
/dev/rmt*.5 Setting #2NoNo
/dev/rmt*.6 Setting #2YesYes
/dev/rmt*.7 Setting #2NoYes


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 Drive

You can perform a mksysb directly to a remote tape by following this procedure. For the purpose of this example, consider two machines:


tapeserver

The machine with the local tape drive


client

The machine to be backed up

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:

  1. Set the default block size of the tape to 512 for the boot section:

  2. tapeserver# chdev -a block_size=512                                                      device                                               

  3. Rewind the tape:

  4. tapeserver# mt -f                                                      device                                                   rewind                      

  5. Create the boot image files:

  6. tapeserver# bosboot -d                                                      no-rewind-device                                                   -a                      

  7. Write the boot image to the tape:

  8. tapeserver# mkinsttape                                                      no-rewind-device                                               

  9. Write a dummy table of contents:

  10. tapeserver# echo "Dummy tape TOC" | dd of=                                                     no-rewind-device                                                   bs=512 conv=sync                      

  11. Change the block size to 1024 for the rest of the tape:

  12. tapeserver# chdev -a block_size=1024                                                      device                                               

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:

  1. Create a pipe for mksysb:

  2. client# mknod p /tmp/mksysb.pipe                      

  3. cat the pipe to the remote tape drive:

  4. client# cat /tmp/mksysb.pipe \                             | rsh                                                      tapeserver                                                   "dd of=                                                     device                                                   obs=100b bs=1024 > /dev/null 2>&1" &                      

  5. Run mksysb with the -e argument against the previously created pipe:

  6. client# mksysb -e /tmp/mksysb.pipe                      

If you are lazy, a script written by Henk van Doorn called rmksysb does all of this.

13.2.4. Backing Up to Disk

It 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 mksysb

Once 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:

  1. mkcd creates temporary files that it uses to create the ISO images.

  2. mkcd creates ISO images from the temporary files.

  3. The ISO images are then used to burn the actual CDs/DVDs.

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:


-e

Excludes the files and/or directories from the backup image listed in the /etc/exclude.volume_group file. You cannot use this flag with the -m or s flags.


-m filename

mksysb_image specifies a previously created mksysb image. If you do not give the - m flag, mkcd calls mksysb. (See the -M flag for more information about where the mksysb image is placed.)


-C directory

Specifies the filesystem used to create the CD filesystem structure, which must have at least 645 MB of available disk space (up to 4.38 GB for DVD-sized images). The CD image consumes only as much room as necessary to contain all the data on the CD.


-I directory

Specifies the directory or filesystem where the final CD images are stored before writing to the CD-R, DVD-R, or DVD-RAM device. If this flag is not used, mkcd uses the /mkcd/cd_images directory if it already exists. If it doesn't exist, the command creates the /mkcd/cd_images filesystem in the volume group given with the -V flag, or in rootvg if that flag is not used.


-P

Creates physical partition mapping during mksysb or savevg creation. You cannot use this flag with -m or -s flags.


-R

Prevents mkcd from removing the final CD images. mkcd defaults by removing everything that it creates when it finishes executing. The -R flag allows multiple CD image sets to be stored or for CD creation (burn) to occur on another system. If multiple volumes are needed, the final images are uniquely named using the process ID and volume suffixes.


-S

Stops mkcd before writing to the CD-R, DVD-R or DVD-RAM without removing the final CD images. The -S flag allows multiple CD sets to be created or for CDs to be created on another system. The images remain in the directory marked by the -I flag or in the /mkcd/cd_images directory if the -I flag is not used. If multiple volumes are required, the final images are uniquely named using the process ID and volume suffixes.


-d CD-or-DVD-writer-device

Indicates the CD-R, DVD-R, or DVD-RAM device (/dev/cd1, for instance). This flag is required unless you use the -S flag.

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 Step

If 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.




Backup & Recovery
Backup & Recovery: Inexpensive Backup Solutions for Open Systems
ISBN: 0596102461
EAN: 2147483647
Year: 2006
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net