AIX backup and recovery

Source: Internet
Author: User

In this example, a 5 GB 8-mm tape drive is used, and its device file is/dev/rmt0.

I. Backup

Backup can be implemented through the command line or SMIT menu.

1. Command Line backup

The AIX commands backup and restore are used for backup and recovery. These two commands complement the standard UNIX utility tar, cpio, dd, and pax. The following describes how to back up the entire file system and a single file or directory.

1) Backup File System

In AIX, the backup command is used to perform a file system dump through the I-node format backup. I-node is a way for AIX to manage data. The basic syntax for backing up a file system in I-node format is:

# Backup-f Device-DumpLevel-u File system

Note:

A Device can be a common file or a Device file.

DumpLevel is from 0 ~ The numeric value of 9. 0 indicates the complete backup of the file system. Other levels indicate increased backups. For example, n-level backups include all files modified after the last n-1 backup.

If the backup level is not specified, the default backup level is 9.

-U option can be used to change the record file used for backup growth. The file is/etc/dumpdates. Before backing up the file system, unmount and fsck should be done first. Of course, the root file system is an exception. If you want to back up the root file system, other file systems mounted on the root, including log file systems, are not backed up.

The following are two examples of using backup.

Example 1: A complete backup of the/home file system:

# Umount/home

# Fsck/home

# Backup-f/dev/rmt0-O-u/home

# Mount/home


Example 2: Back up the root file system. The file changed after the last 0-level backup:

# Backup-f/dev/rmt0-1-u/

In the first example, we used the installation point/home as the name of the file system. This is done to make it easier to remember. Of course, you can also use the raw device file name or block device file name in the backup command. To get the block Device File Name of a file system, use the lsfs command. Adding the character r to the block device file is the name of the bare device file.


2) Back up a single file and directory

Use the-I option to back up a single file and directory. The basic syntax is:

# Backup-f Device-I

Note:

1. If-fDevice is not included, backup is automatically written to the/dev/rfd0 disk drive.

2. The name of the file to be backed up must be provided to backup as the standard input. There are multiple ways to provide backup as a standard input, by entering the name of each file and ending with Ctrl-D; using redirection; using the find command or cat command.

If the backup media is installed, the "-q" option next to the example is used to disable the backup command and prompt the backup media to be loaded.

# Backup-f/dev/rmt0-iq

/. Profile

/Etc/profile

/Home

^ D

# Backup-f/dev/rmt0 </tmp/filelist-iq

# Cat/tmp/filelist | backup-f/dev/rmt0-iq

# Find/home-print | backup-f/dev/rmt0-iq

The last example above backs up all the content in the/home directory. However, in the previous two examples, if/home is included in/tmp/filelist, only the directory name is backed up. To make it back up the directory tree like a backup file, enter:


# Find $ </tmp/filelist)-print | backup-f/dev/rmt0-iq


In addition, to see the file and directory list scroll on the screen when running backup, use-v to select the item. To save these outputs, you can use the redirection standard output or the tee Command, as shown below:

# Find $ </tmp/filelist)-print | backup-f/dev/rmt0-iqv> \/var/adm/backed. up. files

# Find $ </tmp/filelist)-print | backup-f/dev/rmt0-iqv | tee | \

Var/adm/backed. up. files


2. Use the SMIT menu to back up data

Use the smit backfilesys shortcut command to back up the file system.

Use the smit backfile shortcut command to back up data by file name.


Ii. Recovery

The restore command is used to restore files backed up by I-node or by name. This command is only valid for backup files, and determines the format used for backup, which is I-node or name.

The basic syntax for restoring a complete file system is:

# Restore-f Device-r

The basic syntax for restoring a file backed up by name is:

# Restore-f Device-x

Example: restore a complete file system backed up by I-node from tape:

# Restore-f/dev/rmt0-r

You do not need to unmount the file system Before restoring it in this way. However, because the restore uses the relative path name, make sure to change the current directory to the appropriate directory.

Recover a single file backed up through I-node. Use the-I option to start the restore interactive mode, which will guide the entire process of file recovery. For example:

# Restore-f/dev/rmt0-I

Restore all files backed up by name from tape:

# Restore-f/dev/rmt0-x

Extract all files from the tape and display the file name at runtime:

# Restore-f/dev/rmt0-xv

Restore file/home/partlist:

# Restore-f/dev/rmt0-xv/home/partlist

Restore all content from the tape/home directory:

# Restore-f/dev/rmt0-xv-d/home

To avoid file recovery failure, you must know that the file is backed up by name using the full path) or the relative path, which is extremely important. To confirm this, use the-T option to obtain the file list of the backup media, for example:

List Files from/archive/backup1 generated by the backup command:

# Restore-f/archive/backup1-T

List Files from tape:

# Restore-f/dev/rmt0-T

Even if the path name starts with a "point", for example. /Home/partlist: use the name of the file or directory according to the listed content.

Similarly, you can use SMIT to restore a file, run smit restfile to restore a single file, and use smit restfilesys to restore the file system.


Iii. Image backup

Mksysb is a method provided by AIX to generate boot tapes so that the tapes contain an image of the root volume group. This is also a storage method for a single disk system. When the disk fails, it provides a rapid recovery method. Of course, the mksysb image used for restoration should be newer. You can also use mksysb to install another machine, which requires some configuration, such as IP address, because almost everything on the original machine is copied to the tape.

Back up the system image:

# Smit mksysb

The following page is displayed:

---------------------------------------------------------------------------------

Back Up the System

80

Type or select values in entry fields.

Press Enter AFTER making all desired changes.


[TOP] [Entry Fields]

WARNING: Execution of the mksysb command will

Result in the loss of all material

Previusly stored on the selected

Output medium. This command backs

Up only rootvg volume group.

* Backup DEVICE or FILE [] +/

Create MAP files? No +

EXCLUDE files? No +

Make BOOTABLE backup? Yes +

Applies only to tape)

EXPAND/tmp if needed? No +

Applies only to bootable tape)

Number of BLOCKS to write in a single output [] #

Leave blank to use a system default)

---------------------------------------------------------------------------------

Simply enter the name of the device file on the tape drive, such as/dev/rmt0. if the system backs up more than one disk of tape, select yes in FORCE increase of work space if needed.

Mksysb only backs up the root volume group rootvg ). Starting from AIX version 4, you can use the savevg command or the SMIT command smit savevg to create images for other volume groups. For example, to back up a volume group named datavg, enter:

# Savevg-I datavg

The default device is/dev/rmt0. You can use the-f option to specify other devices.

To restore the volume group, run the restvg command or smit restvg command. For example, restore from/dev/rmt0

This volume group does not need to be prompted. Enter:

# Restvg-q

A



Oracle video tutorial follow: http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.