AIX Backup and Restore

27
Backing Up and Restoring Your AIX System May 18, 2001 Authors: Sheila Endres Patrick Laffey Ann Wigginton Contributors: Kim Tran Andrew Wong

description

Aix Documents and Aix Stuff

Transcript of AIX Backup and Restore

Page 1: AIX Backup and Restore

Backing Up and Restoring Your AIX System

May 18, 2001

Authors: Sheila Endres

Patrick Laffey

Ann Wigginton

Contributors: Kim Tran

Andrew Wong

Page 2: AIX Backup and Restore
Page 3: AIX Backup and Restore

Backing Up and Restoring Your AIXSystem

IBM

Page 4: AIX Backup and Restore

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 Contractwith IBM Corp.

Page 5: AIX Backup and Restore

Contents

Backing Up and Restoring Your AIX System . . . . . . . . . . . . . . . . . . . . . . 1Deciding What’s Right for You . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Types of Volume Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Types of Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Interface Alternatives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Requirements for Writable CD and DVD Devices . . . . . . . . . . . . . . . . . . . . 3Additional Prerequisite Information. . . . . . . . . . . . . . . . . . . . . . . . . . 3

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

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

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

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

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

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

© Copyright IBM Corp. 2001 iii

Page 6: AIX Backup and Restore

iv Backing Up and Restoring Your AIX System

Page 7: AIX Backup and Restore

Backing Up and Restoring Your AIX System

The AIX operating system lets you, the system administrator, easily make backups of your systems usingyour choice of window-based interfaces or a command-line interface to execute a very flexible set ofcommands. 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) IY03060and 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 YouBefore you begin backing up your system, there are a number of things you must know and decisions youmust make. For instance, what media do you plan to use: tape, CD, DVD, or a hard disk file? Whatinformation 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 GroupsAIX uses two types of volume groups: the root volume group (or rootvg) and user volume groups (alsocalled nonroot volume groups or nonrootvg).

v The root volume group is a hard disk or group of disks, containing startup files, the Base OperatingSystem (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, itis essential that you know what type of information is being backed up.

Types of BackupsYou can create three types of backups, each with advantages for particular purposes:

Backup to Reinstall the Same SystemBacks 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 backupcan be used to reinstall another system only if you use the original AIX media to retrieve thedifferent filesets needed for the second system’s platform and hardware, a process called cloning.

Backup to Reinstall Another SystemBacks up the operating system (rootvg) on your current system so that it can be booted andrestored onto another system, without using the original AIX media. This type of backup containsall the device packages and support for the different platform types and can be used to installmultiple machines, which is particularly convenient when each machine in the system environment

© Copyright IBM Corp. 2001 1

Page 8: AIX Backup and Restore

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 ismade to a file, it can be used by Network Installation Management (NIM) to clone the sameoperating system environment onto multiple remote machines.

Note: AIX is now available on multiple platforms. Because of the inherent differences between thearchitectures, a backup from a POWER-based system cannot be used to restore anItanium-based system, and vice versa.

Backup to Restore User Volume GroupsBacks up volume groups other than rootvg (the operating system). Although it can be used to backup the rootvg, another backup type is usually used because a bootable rootvg backup is mucheasier to restore.

Interface AlternativesDepending 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 systemadministrator tasks, eliminating your need to know which commands actually accomplish eachtask. If you are using a graphical console, you can run the graphical user interface version of thistool by typing smit on the command line or you can opt for the faster ASCII version of SMIT bytyping smitty on the command line. If you are using an ASCII console, both smit and smitty startthe ASCII version of the tool. All versions of SMIT offer online help, prompts, lists, and fields tofacilitate your selections.

Command LineWhen you know which type of backup you want to do, you can simply enter the appropriatecommands and flags at the system prompt to start a backup or restore. The commands are brieflydescribed in the following section. Detailed information is available in the related man pages.

Web-based System ManagerThis application allows you to do multiple system administrator tasks through wizards, pull-downmenus, and multiple windows. Expanded help is available for each step in a task. You can startthe Web-based System Manager with the wsm command.

CommandsRegardless of whether you use the Web-based System Manager, SMIT, or the command line, AIX usesthe following commands to create backups:

mksysbBacks 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 thebackup on tape, the tape is bootable and includes the installation programs needed to install fromthe backup. The mksysb command creates an image onto tape or in a file. The mkcd commandis used when backing up to CD or DVD.

savevgBacks up a volume group. The savevg command does not generate a bootable tape, even if thevolume group is the rootvg, so the mksysb command is usually used for the rootvg. The savevgcommand creates an image onto tape or in a file for later use. The mkcd command is used whenbacking 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). Themkcd 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

Page 9: AIX Backup and Restore

image to the media, or it calls the mksysb or savevg commands to create the image that will beplaced 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 DevicesIBM 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, youmust own the software and hardware to create a CD file system (Rock Ridge format) and to burn or writethe CD before you can use the mkcd command. IBM does sell and support writable DVDs for chrpsystems. 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 capacityDVDs are available and these, too, work with the current software, provided the information being backedup does not exceed the capacity of a single DVD. Multivolume DVD backups, however, must use 4.7 GBmedia.

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 CDsor DVDs

The file also contains other helpful hints and suggestions for creating CDs or DVDs. The README filesare:

v /usr/lpp/bos.sysmgt/README.oem_cdwriters

v /usr/lpp/bos.sysmgt/README.txt or /usr/lpp/bos.sysmgt/README.html

Additional Prerequisite InformationBefore you make or restore a backup, read the following information:

v You must be familiar with booting procedures for your particular system. These procedures aredescribed 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 inpaging spaces. (A raw device is a logical volume that does not contain a JFS or JFS2 file system. Suchdevices 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 abackup image.

v The mksysb or savevg commands might not back up all device configurations when special featuresare installed, such as /dev/netbios , or when your system uses device drivers that are not shipped withthe operating system.

v Some rspc systems do not support booting from tape. When you are creating a bootable mksysbimage on an rspc system that does not support booting from tape, the mksysb command warns youthat the tape will not be bootable. You can install a mksysb image from a system that does not supportbooting 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.1and later versions.

v You must unmount any local directory that is mounted over another local directory; otherwise thebackup will create two physical copies of the mounted directory.

Backing Up and Restoring Your AIX System 3

Page 10: AIX Backup and Restore

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

4 Backing Up and Restoring Your AIX System

Page 11: AIX Backup and Restore

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 toReinstall the SameSystem

smitty mkcd (CD orDVD) or smittymksysb (tape)

1. Type wsm on command line.2. Choose Backup container (AIX 4.3)or Backup and Restore container (AIX5.1).

mksysb command.(See “Backup to Reinstall theSame System” on page 13 forcommand variations, details,and examples.)

Create Backup toReinstall AnotherSystem

smitty mkcdgeneric(CD or DVD) or smittymksysb (file)

1. Type wsm on command line.2. Choose Backup container (AIX 4.3)or Backup and Restore container (AIX5.1).

mkcd command.(See “Backup to ReinstallAnother System” on page 15for command variations,details, and examples.)

Create Backup toRestore UserVolume Groups

smitty savevg (tape orfile) or smittysavevgcd (CD orDVD)

Tape, file, or CD: 1. Type wsm oncommand line.2. Select the Volumes container.3. Select Volume Groups.4. Select the Volume Group to backup.5. Choose Selected —> Backup .

savevg command.(See “Backup to RestoreNonrootvg Volume Groups” onpage 15 for commandvariations, details, andexamples.)

© Copyright IBM Corp. 2001 5

Page 12: AIX Backup and Restore

6 Backing Up and Restoring Your AIX System

Page 13: AIX Backup and Restore

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 rootvgBackup

smitty lsmksysb 1. Type wsm on command line.2. Choose the Backup container.

listvgbackup command.(See page 17 for commandvariations, details, and examples.)

Verify a UserVolume GroupBackup

smitty lsbackvg (not available) listvgbackup command.(See page 18 for commandvariations, 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-bitcomparison.

© Copyright IBM Corp. 2001 7

Page 14: AIX Backup and Restore

8 Backing Up and Restoring Your AIX System

Page 15: AIX Backup and Restore

Restoring a Backup

The method you choose to restore from backup depends on what you want to restore. This sectiondescribes 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 BackupUse the following procedure to restore any bootable backup onto the same machine on which it wascreated. You can also use the following procedure to restore a backup that was created to reinstall othermachines, such as a generic CD backup, provided the source and destination machines share the samearchitecture (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, referto 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 shutdown 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, andexternal disk drives. (The external devices must be powered on first so that the system unit can detectthem 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 thefollowing 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 theSetup Menu and follow the on-screen instructions to set the following options. If you are usingsome other ASCII terminal, refer to the appropriate hardware documentation to learn how to setthese 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

Page 16: AIX Backup and Restore

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’sguide for your machine. User’s guides for POWER-based systems are available at the following Webaddress: http://www.rs6000.ibm.com/resource/hardware_docs. Refer to Intel documentation forinformation about Itanium-based systems.

8. Answer the installation questions that display. If the backup was created to use the nonpromptedinstallation option, no installation questions will display. For more information, see the Installation Guidefor 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 personalbackup), you cannot use it to reinstall another system without the corresponding AIX product media. Thefollowing procedure describes the steps to restore a personal backup onto a different machine, providedboth machines share the same architecture (both are either POWER-based systems or Itanium-basedsystems):

1. Select the appropriate drive to use as the primary boot device (if it isn’t already). For moreinformation, 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 theappropriate drive. For example, if the backup is of an AIX version 4.3.3 system, insert the productmedia 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 toshut 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

Page 17: AIX Backup and Restore

5. Turn on all attached external devices, such as terminals, CD-ROM drives, tape drives, monitors, andexternal disk drives. (The external devices must be powered on first so that the system unit candetect 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 tostep 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’sGuide for your machine. User’s guides for POWER-based systems are available at the following Webaddress: http://www.rs6000.ibm.com/resource/hardware_docs. Refer to Intel documentation forItanium-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 thebackup media into the chosen drive.

If you want to restore a backup from the same drive that you booted from, then remove the productmedia, 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 GroupsThe following table shows the alternative methods to restore a nonrootvg backup. Before doing any of thefollowing restorations, insert the backup media in the appropriate drive (unless the backup is stored in afile).

Table 3. Restoring a Nonrootvg Volume Group on an AIX System

Task SMIT Web-based System Manager Command Line

Restore NonrootvgVolume Groups

smitty restvg 1. Type wsm on command line.2. Choose Volumes container.3. Select Volume Groups.4. From the Volumes menu,choose Restore Volume Group .

restvg command.(See page 18 for commandvariations, details, and examples.)

Restore Individual Files from a BackupThe following table shows the alternative methods for restoring individual files from a backup. Before doingany of the following restorations, insert the backup media in the appropriate drive (unless the backup isstored in a file).

Table 4. Restoring Individual Files from Backup on an AIX System

Task SMIT Web-basedSystem Manager

Command Line

Restoring Files froma System Backup

smitty restmksysb (not available) restorevgfiles command.(See page 18 for command variations, details, andexamples.)

Restore Files froma NonrootvgBackup

smitty restsavevg (not available) restorevgfiles command.(See page 18 for command variations, details, andexamples.)

Restoring a Backup 11

Page 18: AIX Backup and Restore

12 Backing Up and Restoring Your AIX System

Page 19: AIX Backup and Restore

Examples of Command Flexibility

The AIX command structure allows almost infinite flexibility. The following examples show how to use thecommand line interface to tailor your backup and restore options.

Backup to Reinstall the Same SystemBack 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 -ioption creates a new image.data file, which contains information about the sizes of all the filesystems and logical volumes in your rootvg. This use of the mksysb command does not expandthe /tmp directory, so if the backup runs out of space in /tmp directory, an error occurs. See thefollowing 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 duringa backup, as shown above, the value for this field matches the creation date for its associatedbackup. To determine the date of a backup tape that was created using the mksysb commandwith the -i flag, extract the image.data file from the tape and view the file to find the value of theDATE_TIME field.

If you want to use a customized image.data file, do not use the -i flag. Instead, put yourcustomized image.data file in the / (root) directory. If you do not use the -i flag and the systemcannot find the /image.data file, the mksysb command fails.

Expanding /tmp as neededmksysb -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 ofall 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.datafile and map files. The image.data file contains information about the sizes of all the filesystems and logical volumes in your rootvg. The map files position the logical volumesonto the target drive in the same partitions that they were in on the source system. If youdo not create map files, the installation program relies on the Logical Volume Manager todetermine placement for the logical volumes.

Do not use map files if you plan to reinstall the backup to target systems other than thesource system, or if the disk configuration of the source system is to be changed beforereinstalling the backup.

Excluding a set of filesSpecify which files are to be excluded in the /etc/exclude.rootvg file, and then use thefollowing 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

Page 20: AIX Backup and Restore

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 containsinformation 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 grepcommand 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 notexcluded.

Note: All files are backed up relative to the current working directory. This directory isrepresented by a . (period). To exclude any file or directory for which it is important tohave the search match the string at the beginning of the line, use a | (caret) as thefirst character in the search string, followed by a . (period), and then the file name ordirectory to be excluded.

Back up to a filemksysb -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 filecan be used by the mkcd command as the mksysb image to place onto a CD or DVD. The -X flagautomatically expands /tmp to whatever size the mksysb command requires. The -i optioncreates a new image.data file, which contains information about the sizes of all the file systemsand logical volumes in your rootvg.

Back up to a CD-ROM or DVDmkcd -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 theCD-ROM device named /dev/cd1 that can be used to restore the system. The -L flag in thesecond 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 imagemkcd -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 flaginstructs 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 filesSpecify which files are to be excluded in the /etc/exclude.rootvg file, and then type thefollowing command:mkcd -d /dev/cd1 -e

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

14 Backing Up and Restoring Your AIX System

Page 21: AIX Backup and Restore

Backup to Reinstall Another SystemBackup 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 flaginforms the mkcd command that this is a generic backup. The -p flag informs the mkcd commandwhere the product CD is located, which in this case is /dev/cd0 . The -m flag instructs the mkcdcommand to use the previously created mksysb image named /mksysb_images/mksysb1 . Tomake this backup installable on all systems with compatible architecture, all devices must beinstalled from the product CD, and the backup must use an existing mksysb image.

Excluding a set of filesSpecify which files are to be excluded in the /etc/exclude.rootvg file, and then insert theproduct media that corresponds to the installed system into your CD drive. (The drivedoesn’t have to be writable, because this example only reads and copies the devicepackages.) 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-ROMdevice named /dev/cd1 . It creates a bootable CD that can be used to restore theoperating system on any system. The -G flag informs the mkcd command that this is ageneric 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 previouslycreated mksysb image named /mksysb_images/mksysb1 .

Each line in the /etc/exclude.rootvg file is a pattern-matching expression in the grepcommand 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 notexcluded.

Note: All files are backed up relative to the current working directory. This directory isrepresented by a . (period). To exclude any file or directory for which it is important tohave the search match the string at the beginning of the line, use a | (caret) as thefirst character in the search string, followed by a . (period) and then the file name ordirectory to be excluded.

Backup to Restore Nonrootvg Volume GroupsBack 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 flagcreates a new myvg.data file, which contains information about the sizes of all the file systemsand 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

Page 22: AIX Backup and Restore

Expanding /tmp as neededsavevg -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 uservolume group. The -X flag automatically expands the /tmp directory to whatever size thesavevg command requires. The -i flag creates a new myvg.data file, which containsinformation about the sizes of all the file systems and logical volumes in the volume groupyou 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 savevgcommand requires. The -m flag creates a new myvg.data file and map files. Themyvg.data file contains information about the sizes of all the file systems and logicalvolumes in the volume group you are backing up. The map files position the logicalvolumes onto the target drive in the same partitions that they were in on the sourcesystem. If you do not create map files, the installation program relies on the LogicalVolume 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 thesource system or if the disk configuration of the source system is to be changed beforereinstalling the backup.

Excluding a set of filesSpecify which files are to be excluded in the /etc/exclude. volume_group_name file. (Forthe following example, the exclude file is named /etc/exclude.myvg .) Then type thefollowing: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 thesavevg command requires. The -i flag creates a new myvg.data file, which containsinformation about the sizes of all the file systems and logical volumes in the volume groupyou 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_nameis a pattern-matching expression in the grep command format that matches which files areto 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 examplesis not excluded.

Note: All files are backed up relative to the current working directory. This directory isrepresented by a . (period). To exclude any file or directory for which it is important tohave the search match the string at the beginning of the line, use a | (caret) as thefirst character in the search string, followed by a . (period), and then the file name ordirectory to be excluded.

Back up to a filesavevg -X –i -f /savevg_images/savevg1 myvg

16 Backing Up and Restoring Your AIX System

Page 23: AIX Backup and Restore

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 asthe savevg image to place onto a CD. The -X flag automatically expands the /tmp directory towhatever size the savevg command requires. The -i flag creates a new myvg.data file, whichcontains information about the sizes of all the file systems and logical volumes in the volumegroup you are backing up.

Back up to a CD-ROMmkcd -d /dev/cd1 -v myvg

Makes a backup of the volume group named myvg to the CD-ROM device named /dev/cd1 . Thiswill create a nonbootable CD that can be used to restore the volume group.

Using a previously created savevg imagemkcd -d /dev/cd1 -s /savevg_images/savevg1

Makes a backup of the volume group that has been saved in a previously made savevgimage 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 beused to restore the volume group. The -s flag informs the mkcd command to use thepreviously created savevg image named /savevg_images/savevg1 instead of creating anew savevg image.

Excluding a set of filesSpecify which files are to be excluded in the /etc/exclude. volume_group_name file. (Forthe following example, the exclude file is named /etc/exclude.myvg .) Then type thefollowing: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_nameis a pattern-matching expression in the grep command format that matches which files areto 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 isnot excluded.

Note: All files are backed up relative to the current working directory. This directory isrepresented by a . (period). To exclude any file or directory for which it is important tohave the search match the string at the beginning of the line, use a | (caret) as thefirst character in the search string, followed by a . (period), and then the file name ordirectory to be excluded.

Verifying a BackupVerifying 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

Page 24: AIX Backup and Restore

Also use the media to test whether it boots successfully on the intended systems.

Verifying a User Volume Group Backuplistvgbackup -s -f device_name

Lists the contents of a nonrootvg backup. For example:listvgbackup -s -f /dev/rmt0

Restoring a BackupRestoring a User Volume Group Backup

restvg -f backup_location

Remakes the user volume group and restores the contents of the backup. The following are twoexamples:restvg -f /dev/cd0restvg -f /savevg_images/savevg1

Restoring a User Volume Group Backup Minimizing Spacerestvg -s -f backup_location

Remakes the user volume group and restores the contents of the backup while minimizing thespace required. The following are two examples:restvg -s -f /dev/cd0restvg -s -f /savevg_images/savevg1

Restoring Files from a rootvg Backuprestorevgfiles -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/file3restorevgfiles -d /tmp -f /images/rootvg_image1 ./tmp/file1 ./tmp/file2 ./tmp/file3

Restoring Files from a User Volume Group Backuprestorevgfiles -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/pic2restorevgfiles -s -d /tmp -f /savevg_images/savevg1 ./pictures/pic1 ./pictures/pic2

18 Backing Up and Restoring Your AIX System

Page 25: AIX Backup and Restore

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, andother 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 andrestorations.

v AIX Commands Reference for usage statements, flags not shown in this document, and more in-depthinformation 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

Page 26: AIX Backup and Restore

20 Backing Up and Restoring Your AIX System

Page 27: AIX Backup and Restore

Appendix B. Notices

This document was produced in the United States. IBM may not offer the products, programs, services orfeatures 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 featuresavailable in your area. Any reference to an IBM product, program, service or feature is not intended tostate or imply that only IBM’s product, program, service or feature may be used. Any functionallyequivalent product, program, service or feature that does not infringe on any of IBM’s intellectual propertyrights 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. Thefurnishing of this document does not give you any license to these patents. Send license inquires, inwriting, 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 isdistributed ″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 thisinformation or the implementation of any techniques described herein is a customer responsibility anddepends on the customer’s ability to evaluate and integrate them into the customer’s operationalenvironment. Customers attempting to adapt these techniques to their own environments do so at theirown 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 discussedas of the date of publication. IBM cannot guarantee the accuracy of any information presented after thedate 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 inthis document may have been made on development-level systems. There is no guarantee thesemeasurements will be the same on generally available systems. Some measurements quoted in thisdocument may have been estimated through extrapolation. Actual results may vary. Users of thisdocument should verify the applicable data for their specific environment.

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

© Copyright IBM Corp. 2001 21