Você está na página 1de 27

Backing Up and Restoring Your AIX System

May 18, 2001

Authors: Sheila Endres

Patrick Laffey

Ann Wigginton

Contributors: Kim Tran

Andrew Wong
IBM

Backing Up and Restoring Your AIX


System
Before reading the information in this paper, read the general information in “Appendix B. Notices” on page 21.
© Copyright International Business Machines Corporation 2001. All rights reserved.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
Backing Up and Restoring Your AIX System . . . . . . . . . . . . . . . . . . . . . . 1
Deciding What’s Right for You . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Types of Volume Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Types of Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Interface Alternatives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Requirements for Writable CD and DVD Devices . . . . . . . . . . . . . . . . . . . . 3
Additional Prerequisite Information. . . . . . . . . . . . . . . . . . . . . . . . . . 3

Making a Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

Verifying a Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

Restoring a Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Reinstall a System Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Reinstall a System Backup onto Another System (Cloning) . . . . . . . . . . . . . . . . . 10
Restore Nonrootvg Volume Groups . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Restore Individual Files from a Backup . . . . . . . . . . . . . . . . . . . . . . . . 11

Examples of Command Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . 13


Backup to Reinstall the Same System . . . . . . . . . . . . . . . . . . . . . . . . . 13
Backup to Reinstall Another System . . . . . . . . . . . . . . . . . . . . . . . . . 15
Backup to Restore Nonrootvg Volume Groups . . . . . . . . . . . . . . . . . . . . . . 15
Verifying a Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Restoring a Backup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Appendix A. References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

Appendix B. Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

© Copyright IBM Corp. 2001 iii


iv Backing Up and Restoring Your AIX System
Backing Up and Restoring Your AIX System
The AIX operating system lets you, the system administrator, easily make backups of your systems using
your choice of window-based interfaces or a command-line interface to execute a very flexible set of
commands. By backing up your system, you can:
v Preserve a clean system image to restore in case of a system crash or corruption
v Restore a backup to a different machine (called cloning)
v Preserve users’ work

AIX makes the process of backing up more convenient by offering the following options:
v Exclude individual files or directories from a backup
v Back up to CD, available in AIX Version 4.3.2 with Authorized Program Analysis Report (APAR) IY03060
and all later AIX versions
v Back up to DVD, available in AIX Version 4.3.3 with APAR IY15536 and all later AIX versions
v Restore individual files or an entire backup
v Clone installations across multiple systems using Network Installation Management (NIM)
v Transfer installed software from one system to another

For detailed information about the AIX operating system, refer to the following Web address:
http://www.ibm.com/servers/aix/library. AIX library information is listed under Technical Publications.

Deciding What’s Right for You


Before you begin backing up your system, there are a number of things you must know and decisions you
must make. For instance, what media do you plan to use: tape, CD, DVD, or a hard disk file? What
information do you plan to back up: the operating system, all the application data, or just the user’s data?
The following sections provide you with the information you need to make these decisions.

Types of Volume Groups


AIX uses two types of volume groups: the root volume group (or rootvg) and user volume groups (also
called nonroot volume groups or nonrootvg).
v The root volume group is a hard disk or group of disks, containing startup files, the Base Operating
System (BOS), configuration information, and any optional software.
v A user volume group typically contains data files and application software.

There are different commands to back up each type of volume group. When you use these commands, it
is essential that you know what type of information is being backed up.

Types of Backups
You can create three types of backups, each with advantages for particular purposes:
Backup to Reinstall the Same System
Backs up the operating system (rootvg) in a form that is bootable only on the source system.
When this backup is made to a CD or DVD, it is called a personal backup. This type of backup
can be used to reinstall another system only if you use the original AIX media to retrieve the
different filesets needed for the second system’s platform and hardware, a process called cloning.
Backup to Reinstall Another System
Backs up the operating system (rootvg) on your current system so that it can be booted and
restored onto another system, without using the original AIX media. This type of backup contains
all the device packages and support for the different platform types and can be used to install
multiple machines, which is particularly convenient when each machine in the system environment

© Copyright IBM Corp. 2001 1


needs to have the same image installed, but each might have different hardware configurations.
When this backup is made to a CD or DVD, it is called a generic backup. If this type of backup is
made to a file, it can be used by Network Installation Management (NIM) to clone the same
operating system environment onto multiple remote machines.

Note: AIX is now available on multiple platforms. Because of the inherent differences between the
architectures, a backup from a POWER-based system cannot be used to restore an
Itanium-based system, and vice versa.
Backup to Restore User Volume Groups
Backs up volume groups other than rootvg (the operating system). Although it can be used to back
up the rootvg, another backup type is usually used because a bootable rootvg backup is much
easier to restore.

Interface Alternatives
Depending on your preference, you can use any of the following to perform a backup or restore:
SMIT (smitty)
The System Management Interface Tool (SMIT) lets you use menus to do multiple system
administrator tasks, eliminating your need to know which commands actually accomplish each
task. If you are using a graphical console, you can run the graphical user interface version of this
tool by typing smit on the command line or you can opt for the faster ASCII version of SMIT by
typing smitty on the command line. If you are using an ASCII console, both smit and smitty start
the ASCII version of the tool. All versions of SMIT offer online help, prompts, lists, and fields to
facilitate your selections.
Command Line
When you know which type of backup you want to do, you can simply enter the appropriate
commands and flags at the system prompt to start a backup or restore. The commands are briefly
described in the following section. Detailed information is available in the related man pages.
Web-based System Manager
This application allows you to do multiple system administrator tasks through wizards, pull-down
menus, and multiple windows. Expanded help is available for each step in a task. You can start
the Web-based System Manager with the wsm command.

Commands
Regardless of whether you use the Web-based System Manager, SMIT, or the command line, AIX uses
the following commands to create backups:
mksysb
Backs up the operating system as part of the rootvg. If a system has been corrupted, for example,
you can use a root volume group backup to restore a system to its original state. If you create the
backup on tape, the tape is bootable and includes the installation programs needed to install from
the backup. The mksysb command creates an image onto tape or in a file. The mkcd command
is used when backing up to CD or DVD.
savevg
Backs up a volume group. The savevg command does not generate a bootable tape, even if the
volume group is the rootvg, so the mksysb command is usually used for the rootvg. The savevg
command creates an image onto tape or in a file for later use. The mkcd command is used when
backing up to CD or DVD.
mkcd Backs up a volume group to a writable CD (AIX Version 4.3.2 with APAR IY03060 and later). The
mkcd command can also back up to DVD media (AIX Version 4.3.3 with APAR IY15536 and later)
if you are using a chrp platform. (To determine whether you are using a chrp system, run bootinfo
-p as root user.) The mkcd command transfers a previously made mksysb image or savevg

2 Backing Up and Restoring Your AIX System


image to the media, or it calls the mksysb or savevg commands to create the image that will be
placed onto the media. Compared to other backup media, CDs and DVDs are portable,
inexpensive, and highly reliable.
restvg Restores a user volume group.

Requirements for Writable CD and DVD Devices


IBM does not sell or support the software or hardware that is used to create CDs. Beginning in AIX 5.1,
the product media provides GNU software for this purpose. If you are using an earlier AIX version, you
must own the software and hardware to create a CD file system (Rock Ridge format) and to burn or write
the CD before you can use the mkcd command. IBM does sell and support writable DVDs for chrp
systems. To determine whether you are using a chrp system, run bootinfo -p as root user.

When backing up to DVD, the mkcd command assumes the backup media is 4.7 GB. Smaller capacity
DVDs are available and these, too, work with the current software, provided the information being backed
up does not exceed the capacity of a single DVD. Multivolume DVD backups, however, must use 4.7 GB
media.

Refer to the various README files for the following information:


v The list of hardware that has been successfully tested with the mkcd command
v The list of CD-creation software that has been successfully tested with the mkcd command
v Information on acquiring CD-creation software
v Information on how to set up your hardware and software to enable the mkcd command to create CDs
or DVDs

The file also contains other helpful hints and suggestions for creating CDs or DVDs. The README files
are:
v /usr/lpp/bos.sysmgt/README.oem_cdwriters
v /usr/lpp/bos.sysmgt/README.txt or /usr/lpp/bos.sysmgt/README.html

Additional Prerequisite Information


Before you make or restore a backup, read the following information:
v You must be familiar with booting procedures for your particular system. These procedures are
described in your system’s user’s guide.
v The image that the mksysb or savevg command creates does not include data on raw devices or in
paging spaces. (A raw device is a logical volume that does not contain a JFS or JFS2 file system. Such
devices are often used by database applications that write directly to the device.)
v If your system includes a remote-mounted /usr file system, you cannot reinstall your system from a
backup image.
v The mksysb or savevg commands might not back up all device configurations when special features
are installed, such as /dev/netbios, or when your system uses device drivers that are not shipped with
the operating system.
v Some rspc systems do not support booting from tape. When you are creating a bootable mksysb
image on an rspc system that does not support booting from tape, the mksysb command warns you
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 then entering maintenance mode. In maintenance mode,
you can choose to install the system backup from tape.
v Only mounted JFS and JFS2 file systems are backed up. JFS2 file systems are supported in AIX 5.1
and later versions.
v You must unmount any local directory that is mounted over another local directory; otherwise the
backup will create two physical copies of the mounted directory.

Backing Up and Restoring Your AIX System 3


v If you are making a backup of the rootvg, record any backed-up root and user passwords. These
passwords will be active on any systems restored from this backup.

4 Backing Up and Restoring Your AIX System


Making a Backup
The following table provides a quick overview of your backup options.
Table 1. Making a Backup on an AIX System
Task SMIT Web-based System Manager Command Line
Create Backup to smitty mkcd (CD or 1. Type wsm on command line. mksysb command.
Reinstall the Same DVD) or smitty 2. Choose Backup container (AIX 4.3) (See “Backup to Reinstall the
System mksysb (tape) or Backup and Restore container (AIX Same System” on page 13 for
5.1). command variations, details,
and examples.)
Create Backup to smitty mkcdgeneric 1. Type wsm on command line. mkcd command.
Reinstall Another (CD or DVD) or smitty 2. Choose Backup container (AIX 4.3) (See “Backup to Reinstall
System mksysb (file) or Backup and Restore container (AIX Another System” on page 15
5.1). for command variations,
details, and examples.)
Create Backup to smitty savevg (tape or Tape, file, or CD: 1. Type wsm on savevg command.
Restore User file) or smitty command line. (See “Backup to Restore
Volume Groups savevgcd (CD or 2. Select the Volumes container. Nonrootvg Volume Groups” on
DVD) 3. Select Volume Groups. page 15 for command
4. Select the Volume Group to back variations, details, and
up. examples.)
5. Choose Selected —> Backup.

© Copyright IBM Corp. 2001 5


6 Backing Up and Restoring Your AIX System
Verifying a Backup
The following table summarizes your options for verifying a backup.
Table 2. Verifying a Backup on an AIX System
Task SMIT Web-based System Manager Command Line
Verify a rootvg smitty lsmksysb 1. Type wsm on command line. listvgbackup command.
Backup 2. Choose the Backup container. (See page 17 for command
variations, details, and examples.)
Verify a User smitty lsbackvg (not available) listvgbackup command.
Volume Group (See page 18 for command
Backup variations, details, and examples.)

Notes:
1. If this is a bootable backup, also use the media to test whether it boots on the intended systems.
2. Verification of the backup checks the contents of the backup. It does not perform a bit-by-bit
comparison.

© Copyright IBM Corp. 2001 7


8 Backing Up and Restoring Your AIX System
Restoring a Backup
The method you choose to restore from backup depends on what you want to restore. This section
describes steps for the following tasks:
v Reinstall a System Backup
v Reinstall a System Backup onto Another System (Cloning)
v Restore Nonrootvg Volume Groups
v Restore Individual Files from a Backup

You must have root user authority to complete any of these procedures.

Reinstall a System Backup


Use the following procedure to restore any bootable backup onto the same machine on which it was
created. You can also use the following procedure to restore a backup that was created to reinstall other
machines, such as a generic CD backup, provided the source and destination machines share the same
architecture (both are either POWER-based systems or Itanium-based systems).
1. Select the appropriate drive as the primary boot device (if it isn’t already). For more information, refer
to the section in your hardware documentation that deals with booting options.
2. Insert the backup media into the appropriate drive.

Note: If the system is currently shut down, the drive door might not open. When this is the case,
use the following procedure:
a. Turn on the system.
b. Insert the media in the appropriate drive.
c. Turn off the system and wait 30 seconds.
3. Shut down the system (if it is not already shut down). You can use the shutdown -F command to shut
down the system.
4. Turn the system key for the lock (if your system has one) to the Service position.
5. Turn on all attached external devices, such as terminals, CD-ROM drives, tape drives, monitors, and
external disk drives. (The external devices must be powered on first so that the system unit can detect
them during the startup process.)
6. If you are using a graphical console, skip to the next step. If you are using an ASCII terminal, use the
following criteria to set the communications, keyboard, and display options.

Note: If your terminal is an IBM 3151, 3161, or 3164, press the Ctrl+Setup keys to display the
Setup Menu and follow the on-screen instructions to set the following options. If you are using
some other ASCII terminal, refer to the appropriate hardware documentation to learn how to set
these options. Some terminals have different option names and settings from those listed here.

Communications Options
Option Setting
Line Speed (baud rate) 9600
Word Length (bits per character) 8
Parity no (none)
Number of Stop Bits 1
Interface RS-232C (or RS-422A)
Line Control IPRTS

© Copyright IBM Corp. 2001 9


Keyboard and Display Options
Option Setting
Screen normal
Row and Column 24x80
Scroll jump
Auto LF (line feed) off
Line Wrap on
Forcing Insert line (or both)
Tab field
Operating Mode echo
Turnaround Character CR
Enter return
Return new line
New Line CR
Send page
Insert Character space

7. Reboot the machine from the backup media. If you need details about this procedure, see the user’s
guide for your machine. User’s guides for POWER-based systems are available at the following Web
address: http://www.rs6000.ibm.com/resource/hardware_docs. Refer to Intel documentation for
information about Itanium-based systems.
8. Answer the installation questions that display. If the backup was created to use the nonprompted
installation option, no installation questions will display. For more information, see the Installation Guide
for the version of AIX that you are using.
9. When the installation is complete, turn the system key for the lock (if present) to the Normal position.

Reinstall a System Backup onto Another System (Cloning)


If the backup you have was created to restore only its source system (sometimes called a personal
backup), you cannot use it to reinstall another system without the corresponding AIX product media. The
following procedure describes the steps to restore a personal backup onto a different machine, provided
both machines share the same architecture (both are either POWER-based systems or Itanium-based
systems):
1. Select the appropriate drive to use as the primary boot device (if it isn’t already). For more
information, refer to the section in your hardware documentation that deals with booting options.
2. Insert the product media (that is at the same maintenance level as the backup to be restored) into the
appropriate drive. For example, if the backup is of an AIX version 4.3.3 system, insert the product
media for AIX version 4.3.3.

Note: If the system is currently shut down, the drive door might not open. When this is the case,
use the following procedure:
a. Turn on the system.
b. Insert the media in the appropriate drive.
c. Turn off the system and wait 30 seconds.
3. Shut down the system (if it is not already shut down). You can use the shutdown -F command to
shut down the system.
4. Turn the system key for the lock (if your system has one) to the Service position.

10 Backing Up and Restoring Your AIX System


5. Turn on all attached external devices, such as terminals, CD-ROM drives, tape drives, monitors, and
external disk drives. (The external devices must be powered on first so that the system unit can
detect them during the startup process.)
6. If you are using a graphical console, skip to the next step. If you are using an ASCII console, refer to
step 6 of Reinstall a System Backup for setup instructions.
7. Reboot the machine from the AIX media. If you need details about this procedure, see the User’s
Guide for your machine. User’s guides for POWER-based systems are available at the following Web
address: http://www.rs6000.ibm.com/resource/hardware_docs. Refer to Intel documentation for
Itanium-based systems.
8. Select the Start Maintenance Mode for System Recovery option.
9. Select the Install from a System Backup option.
10. If the drive you chose for the backup media is not the drive that holds the product media, insert the
backup media into the chosen drive.
If you want to restore a backup from the same drive that you booted from, then remove the product
media, insert the backup media, select the drive, and press Enter.
11. Answer the installation questions that display.
12. When the installation is complete, turn the system key for the lock (if present) to the Normal position.

Restore Nonrootvg Volume Groups


The following table shows the alternative methods to restore a nonrootvg backup. Before doing any of the
following restorations, insert the backup media in the appropriate drive (unless the backup is stored in a
file).
Table 3. Restoring a Nonrootvg Volume Group on an AIX System
Task SMIT Web-based System Manager Command Line
Restore Nonrootvg smitty restvg 1. Type wsm on command line. restvg command.
Volume Groups 2. Choose Volumes container. (See page 18 for command
3. Select Volume Groups. variations, details, and examples.)
4. From the Volumes menu,
choose Restore Volume Group.

Restore Individual Files from a Backup


The following table shows the alternative methods for restoring individual files from a backup. Before doing
any of the following restorations, insert the backup media in the appropriate drive (unless the backup is
stored in a file).
Table 4. Restoring Individual Files from Backup on an AIX System
Task SMIT Web-based Command Line
System Manager
Restoring Files from smitty restmksysb (not available) restorevgfiles command.
a System Backup (See page 18 for command variations, details, and
examples.)
Restore Files from smitty restsavevg (not available) restorevgfiles command.
a Nonrootvg (See page 18 for command variations, details, and
Backup examples.)

Restoring a Backup 11
12 Backing Up and Restoring Your AIX System
Examples of Command Flexibility
The AIX command structure allows almost infinite flexibility. The following examples show how to use the
command line interface to tailor your backup and restore options.

Backup to Reinstall the Same System


Back up to a tape device
mksysb -i /dev/rmt1
Makes a backup of the operating system (rootvg) to the tape device named /dev/rmt1. The -i
option creates a new image.data file, which contains information about the sizes of all the file
systems and logical volumes in your rootvg. This use of the mksysb command does not expand
the /tmp directory, so if the backup runs out of space in /tmp directory, an error occurs. See the
following example to automatically expand the /tmp directory as needed, by using the -X flag.
The image.data file also contains a DATE_TIME field. When the image.data file is created during
a backup, as shown above, the value for this field matches the creation date for its associated
backup. To determine the date of a backup tape that was created using the mksysb command
with the -i flag, extract the image.data file from the tape and view the file to find the value of the
DATE_TIME field.
If you want to use a customized image.data file, do not use the -i flag. Instead, put your
customized image.data file in the / (root) directory. If you do not use the -i flag and the system
cannot find the /image.data file, the mksysb command fails.
Expanding /tmp as needed
mksysb -X -i /dev/rmt0
Makes a backup of the operating system (rootvg) to the tape device named /dev/rmt0.
The -X flag automatically expands /tmp to whatever size the mksysb command requires.
The -i option creates a new image.data file, which contains information about the sizes of
all the file systems and logical volumes in your rootvg.
This method is probably the most commonly used to back up an individual machine.
Saving physical locations (map files)
mksysb -X -m /dev/rmt0
Makes a backup of the operating system (rootvg) to the tape device named /dev/rmt0.
The -X flag automatically expands /tmp to whatever size the mksysb command requires.
The -i flag, in this instance, is not needed because the -m flag creates a new image.data
file and map files. The image.data file contains information about the sizes of all the file
systems and logical volumes in your rootvg. The map files position the logical volumes
onto the target drive in the same partitions that they were in on the source system. If you
do not create map files, the installation program relies on the Logical Volume Manager to
determine placement for the logical volumes.
Do not use map files if you plan to reinstall the backup to target systems other than the
source system, or if the disk configuration of the source system is to be changed before
reinstalling the backup.
Excluding a set of files
Specify which files are to be excluded in the /etc/exclude.rootvg file, and then use the
following command:
mksysb -X -i -e /dev/rmt0

This example makes a backup of the operating system (rootvg) to the tape device named
/dev/rmt0. The -X flag automatically expands /tmp to whatever size the mksysb

© Copyright IBM Corp. 2001 13


command requires. The -e flag specifies to not back up the files listed in the
/etc/exclude.rootvg file. The -i option creates a new image.data file, which contains
information about the sizes of all the file systems and logical volumes in your rootvg.

Each line in the /etc/exclude.rootvg file is a pattern-matching expression in the grep


command format that matches the files to be excluded. See the following examples:
v If the /etc/exclude.rootvg file contains the following:
/scratch/

then all the files in any directory named scratch are excluded.
v If the /etc/exclude.rootvg file contains the following:
|./tmp/

then all the files in /tmp/ are excluded, but any other directory named tmp is not
excluded.

Note: All files are backed up relative to the current working directory. This directory is
represented by a . (period). 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 a | (caret) as the
first character in the search string, followed by a . (period), and then the file name or
directory to be excluded.
Back up to a file
mksysb -X -i /mksysb_images/mksysb1
Makes a backup of the operating system (rootvg) to a file named /mksysb_images/mksysb1.
This file is not bootable but can be installed using Network Installation Management (NIM). The file
can be used by the mkcd command as the mksysb image to place onto a CD or DVD. The -X flag
automatically expands /tmp to whatever size the mksysb command requires. The -i option
creates a new image.data file, which contains information about the sizes of all the file systems
and logical volumes in your rootvg.
Back up to a CD-ROM or DVD
mkcd -d /dev/cd1 or mkcd -L d /dev/cd0
Makes a backup of the operating system (rootvg). The first example creates a bootable CD on the
CD-ROM device named /dev/cd1 that can be used to restore the system. The -L flag in the
second example indicates the backup is DVD. The DVD device name in the second example is
/dev/cd0. You must use the -L flag with the mkcd command to create a DVD backup.
Using a previously created mksysb image
mkcd -d /dev/cd1 -m /mksysb_images/mksysb1
Makes a backup of the operating system (rootvg) to the CD-ROM device named /dev/cd1.
This example creates a bootable CD that can be used to restore the system. The -m flag
instructs the mkcd command to use the previously created mksysb image named
/mksysb_images/mksysb1 instead of creating a new mksysb image.
Excluding a set of files
Specify which files are to be excluded in the /etc/exclude.rootvg file, and then type the
following command:
mkcd -d /dev/cd1 -e

This example makes a backup of the operating system (rootvg) to the CD-ROM device
named /dev/cd1. It creates a bootable CD that can be used to restore the system. The -e
option specifies to not back up the files listed in the /etc/exclude.rootvg file. This option
uses the same pattern-matching expressions as the exclude example under Backup to a
Tape Device earlier in this section.

14 Backing Up and Restoring Your AIX System


Backup to Reinstall Another System
Backup to CD
mkcd -G -d /dev/cd1 -p /dev/cd0 –m /mksysb_images/mksysb1
Makes a generic backup of the operating system (rootvg) to the CD-ROM device named /dev/cd1.
This example creates a bootable CD that can be used to restore to any system. The -G flag
informs the mkcd command that this is a generic backup. The -p flag informs the mkcd command
where the product CD is located, which in this case is /dev/cd0. The -m flag instructs the mkcd
command to use the previously created mksysb image named /mksysb_images/mksysb1. To
make this backup installable on all systems with compatible architecture, all devices must be
installed from the product CD, and the backup must use an existing mksysb image.
Excluding a set of files
Specify which files are to be excluded in the /etc/exclude.rootvg file, and then insert the
product media that corresponds to the installed system into your CD drive. (The drive
doesn’t have to be writable, because this example only reads and copies the device
packages.) Next, type the following on the command line:
mkcd -G -e -d /dev/cd1 -p /dev/cd0 -m /mksysb_images/mksysb1

This example makes a generic backup of the operating system (rootvg) to the CD-ROM
device named /dev/cd1. It creates a bootable CD that can be used to restore the
operating system on any system. The -G flag informs the mkcd command that this is a
generic backup. The -p flag informs the mkcd command where the product CD is located,
which in this case is /dev/cd0. The -e flag specifies to not back up the files listed in the
/etc/exclude.rootvg file. The -m flag instructs the mkcd command to use the previously
created mksysb image named /mksysb_images/mksysb1.

Each line in the /etc/exclude.rootvg file is a pattern-matching expression in the grep


command format that matches which files are to be excluded. See the following examples:
v If the /etc/exclude.rootvg file contains the following:
/scratch/

then all the files within any directory named scratch are excluded.
v If the /etc/exclude.rootvg file contains the following:
|./tmp/

then all the files in /tmp/ are excluded but any other directory named tmp are not
excluded.

Note: All files are backed up relative to the current working directory. This directory is
represented by a . (period). 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 a | (caret) as the
first character in the search string, followed by a . (period) and then the file name or
directory to be excluded.

Backup to Restore Nonrootvg Volume Groups


Back up to a tape device
savevg –i –f /dev/rmt1 myvg
Makes a backup of the volume group named myvg to the tape device named /dev/rmt1. The -i flag
creates a new myvg.data file, which contains information about the sizes of all the file systems
and logical volumes in the volume group you are backing up. This example does not expand the
/tmp directory automatically. If the backup runs out of space in the /tmp directory, an error occurs.
See the following example to increase the space in the /tmp directory if needed.

Examples of Command Flexibility 15


Expanding /tmp as needed
savevg -X -i -f /dev/rmt1 myvg
Makes a backup of the volume group named myvg to the tape device named /dev/rmt1.
This example is probably the most commonly used method to back up a non-root user
volume group. The -X flag automatically expands the /tmp directory to whatever size the
savevg command requires. The -i flag creates a new myvg.data file, which contains
information about the sizes of all the file systems and logical volumes in the volume group
you are backing up.
Saving physical locations (map files)
savevg -X -m -f /dev/rmt1 myvg
Makes a backup of the volume group named myvg to the tape device named /dev/rmt1.
The -X flag automatically expands the /tmp directory to whatever size the savevg
command requires. The -m flag creates a new myvg.data file and map files. The
myvg.data file contains information about the sizes of all the file systems and logical
volumes in the volume group you are backing up. The map files position the logical
volumes onto the target drive in the same partitions that they were in on the source
system. If you do not create map files, the installation program relies on the Logical
Volume Manager to determine placement for the logical volumes.
Do not use map files if you plan to reinstall the backup to target systems other than the
source system or if the disk configuration of the source system is to be changed before
reinstalling the backup.
Excluding a set of files
Specify which files are to be excluded in the /etc/exclude.volume_group_name file. (For
the following example, the exclude file is named /etc/exclude.myvg.) Then type the
following:
savevg -X -i -e -f /dev/rmt1 myvg

This example makes a backup of the volume group named myvg to the tape device named
/dev/rmt1. The -X flag automatically expands the /tmp directory to whatever size the
savevg command requires. The -i flag creates a new myvg.data file, which contains
information about the sizes of all the file systems and logical volumes in the volume group
you are backing up. The -e option specifies to not back up the files listed in the file
/etc/exclude.volume_group_name. Each line in the file /etc/exclude.volume_group_name
is a pattern-matching expression in the grep command format that matches which files are
to be excluded. See the following examples:
v If the /etc/exclude.myvg file contains the following:
/scratch/

then all the files within any directory named scratch are excluded.
v If the /etc/exclude.myvg file contains the following:
|./examples/

then all the files in /examples/ are excluded, but any other directory named examples
is not excluded.

Note: All files are backed up relative to the current working directory. This directory is
represented by a . (period). 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 a | (caret) as the
first character in the search string, followed by a . (period), and then the file name or
directory to be excluded.
Back up to a file
savevg -X –i -f /savevg_images/savevg1 myvg

16 Backing Up and Restoring Your AIX System


Makes a backup of the volume group named myvg. The backup is written to a file named
/savevg_images/savevg1. This file can be easily restored or passed to the mkcd command as
the savevg image to place onto a CD. The -X flag automatically expands the /tmp directory to
whatever size the savevg command requires. The -i flag creates a new myvg.data file, which
contains information about the sizes of all the file systems and logical volumes in the volume
group you are backing up.
Back up to a CD-ROM
mkcd -d /dev/cd1 -v myvg
Makes a backup of the volume group named myvg to the CD-ROM device named /dev/cd1. This
will create a nonbootable CD that can be used to restore the volume group.
Using a previously created savevg image
mkcd -d /dev/cd1 -s /savevg_images/savevg1
Makes a backup of the volume group that has been saved in a previously made savevg
image to the CD-ROM device named /dev/cd1. (The mkcd command always expands the
/tmp directory to whatever size it requires.) This creates a nonbootable CD that can be
used to restore the volume group. The -s flag informs the mkcd command to use the
previously created savevg image named /savevg_images/savevg1 instead of creating a
new savevg image.
Excluding a set of files
Specify which files are to be excluded in the /etc/exclude.volume_group_name file. (For
the following example, the exclude file is named /etc/exclude.myvg.) Then type the
following:
mkcd -e -d /dev/cd1 -v myvg

This example makes a backup of the volume group named myvg to the device named
/dev/cd1. This will create a nonbootable CD that can be used to restore the volume group.
The -e option specifies to not back up the files listed in the file
/etc/exclude.volume_group_name. Each line in the file /etc/exclude.volume_group_name
is a pattern-matching expression in the grep command format that matches which files are
to be excluded. See the following examples:
v If the /etc/exclude.myvg file contains the following:
/scratch/

then all the files within any directory named scratch are excluded.
v If the /etc/exclude.myvg file contains the following:
|./examples/

then all the files in /examples/ are excluded but any other directory named examples is
not excluded.

Note: All files are backed up relative to the current working directory. This directory is
represented by a . (period). 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 a | (caret) as the
first character in the search string, followed by a . (period), and then the file name or
directory to be excluded.

Verifying a Backup
Verifying a rootvg Backup
listvgbackup -f device_name
Lists the contents of a rootvg backup. For example:
listvgbackup -f /dev/rmt0

Examples of Command Flexibility 17


Also use the media to test whether it boots successfully on the intended systems.
Verifying a User Volume Group Backup
listvgbackup -s -f device_name
Lists the contents of a nonrootvg backup. For example:
listvgbackup -s -f /dev/rmt0

Restoring a Backup
Restoring a User Volume Group Backup
restvg -f backup_location
Remakes the user volume group and restores the contents of the backup. The following are two
examples:
restvg -f /dev/cd0
restvg -f /savevg_images/savevg1
Restoring a User Volume Group Backup Minimizing Space
restvg -s -f backup_location
Remakes the user volume group and restores the contents of the backup while minimizing the
space required. The following are two examples:
restvg -s -f /dev/cd0
restvg -s -f /savevg_images/savevg1
Restoring Files from a rootvg Backup
restorevgfiles -d restore_location -f backup_location list_of_files
Restores the specified files from a rootvg backup. The following are two examples:
restorevgfiles -d /tmp -f /dev/cd0 ./tmp/file1 ./tmp/file2 ./tmp/file3
restorevgfiles -d /tmp -f /images/rootvg_image1 ./tmp/file1 ./tmp/file2 ./tmp/file3
Restoring Files from a User Volume Group Backup
restorevgfiles -s -d /tmp -f backup_location list_of_files
Restores the specified files from a rootvg backup. The following are two examples:
restorevgfiles -s -d /tmp -f /dev/cd0 ./pictures/pic1 ./pictures/pic2
restorevgfiles -s -d /tmp -f /savevg_images/savevg1 ./pictures/pic1 ./pictures/pic2

18 Backing Up and Restoring Your AIX System


Appendix A. References
For more information about creating, verifying, or restoring backups, see the following:
v AIX Installation Guide for detailed information on making and restoring backups.
v The following files provide detailed information on CD-ROM or DVD creation, setup, requirements, and
other issues:
– /usr/lpp/bos.sysmgt/README.oem_cdwriters and
– /usr/lpp/bos.sysmgt/README.txt or /usr/lpp/bos.sysmgt/README.html
v Network Installation Management (NIM) Guide for information about remote network backups and
restorations.
v AIX Commands Reference for usage statements, flags not shown in this document, and more in-depth
information on each command discussed in this paper.

For detailed information about the AIX operating system, refer to the following Web address:
http://www.ibm.com/servers/aix/library. AIX library information is listed under Technical Publications.

© Copyright IBM Corp. 2001 19


20 Backing Up and Restoring Your AIX System
Appendix B. Notices
This document was produced in the United States. IBM may not offer the products, programs, services or
features discussed herein in other countries, and the information may be subject to change without notice.
Consult your local IBM business contact for information on the products, programs, services, and features
available in your area. Any reference to an IBM product, program, service or feature is not intended to
state or imply that only IBM’s product, program, service or feature may be used. Any functionally
equivalent product, program, service or feature that does not infringe on any of IBM’s intellectual property
rights may be used instead of the IBM product, program, service or feature.

IBM may have patents or pending patent applications covering subject matter in this document. The
furnishing of this document does not give you any license to these patents. Send license inquires, in
writing, to IBM Director of Licensing, IBM Corporation, New Castle Drive, Armonk, NY 10504-1785 USA.

The information contained in this document has not been submitted to any formal IBM test and is
distributed ″AS IS″. While each item may have been reviewed by IBM for accuracy in a specific situation,
there is no guarantee that the same or similar results will be obtained elsewhere. The use of this
information or the implementation of any techniques described herein is a customer responsibility and
depends on the customer’s ability to evaluate and integrate them into the customer’s operational
environment. Customers attempting to adapt these techniques to their own environments do so at their
own risk.

IBM is not responsible for printing errors in this publication that result in pricing or information inaccuracies.

The information contained in this document represents the current views of IBM on the issues discussed
as of the date of publication. IBM cannot guarantee the accuracy of any information presented after the
date of publication.

Any performance data contained in this document was determined in a controlled environment. Therefore,
the results obtained in other operating environments may vary significantly. Some measurements quoted in
this document may have been made on development-level systems. There is no guarantee these
measurements will be the same on generally available systems. Some measurements quoted in this
document may have been estimated through extrapolation. Actual results may vary. Users of this
document should verify the applicable data for their specific environment.

The following terms are trademarks of International Business Machines Corporation in the United States
and/or other countries: AIX, IBM. A full list of U.S. trademarks owned by IBM can be found at
http://iplswww.nas.ibm.com/wpts/trademarks/trademar.htm. Itanium is a trademark of Intel Corporation in
the United States, other countries, or both. Other company, product and service names may be
trademarks or service marks of others.

© Copyright IBM Corp. 2001 21