[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 1

backup Command

Purpose

Backs up files and file systems.

Syntax

To Back Up Files by Name

backup -i-b Number ] [ -p -e RegularExpression ] ] [ -f Device ] [ -l Number ] [ -o ] [ -q ] [ -v ]

To Back Up File Systems by i-node

backup [ [ -Level ] [ -b Number ] [ -c ] [ -f Device ] [ -L Length ] [ -u ] ] [ FileSystem ]  | [ -w -W ]

Description

The backup command creates copies of your files on a backup medium, such as a magnetic tape or diskette. The copies are in one of the two backup formats:

If you issue the backup command without any parameters, it defaults to a level 9 i-node backup of the root file system to the /dev/rfd0 device. The default syntax is:

-9uf/dev/rfd0 /dev/rhd4 

The default backup device is /dev/rfd0. If flags are specified that are not appropriate for the specified backup device, the backup command displays an error message and continues with the backup.

A single backup can span multiple volumes.

Notes:
  1. Running the backup command results in the loss of all material previously stored on the selected output medium.
  2. Data integrity of the archive may be compromised if a file is modified during system backup. Keep system activity at a minimum during the system backup procedure.
  3. If a backup is made to a tape device with the device block size set to 0, it might be difficult to restore data from the tape unless the default write size was used with the backup command. The default write size for the backup command can be read by the restore command when the tape device block size is 0.

    In other words, the -b flag should not be specified when the tape device block size is 0. If the -b flag of the backup command is specified and is different from the default size, the same size must be specified with the -b flag of the restore command when the archived files are restored from the tape.

Backing Up Files by Name

To back up by name, use the -i flag. The backup command reads standard input for the names of the files to be backed up.

File types can be special files, regular files, or directories. When the file type is a directory, only the directory is backed up. The files under the directory are not backed up, unless they are explicitly specified.

Notes:
  1. Files are restored using the same path names as the archived files. Therefore, to create a backup that can be restored from any path, use full path names for the files that you want to back up.
  2. When backing up files that require multiple volumes, do not enter the list of file names from the keyboard. Instead, pipe or redirect the list from a file to the backup command.

    When you enter the file names from the keyboard and the backup process needs a new tape or diskette, the command "loses" any file names already entered but not yet backed up. To avoid this problem, enter each file name only after the archived message for the previous file has been displayed. The archived message consists of the character a followed by the file name.

  3. If you specify the -p flag, only files of less than 2GB are packed.

Backing Up File Systems by i-node

To back up a file system by i-node, specify the -Level and FileSystem parameters. When used in conjunction with the -u flag, the -Level parameter provides a method of maintaining a hierarchy of incremental backups for each file system. Specify the -u flag and set the -Level parameter to n to back up only those files that have been modified since the n-1 level backup. Information regarding the date, time, and level of each incremental backup is written to the /etc/dumpdates file. The possible backup levels are 0 to 9. A level 0 backup archives all files in the file system. If the /etc/dumpdates file contains no backup information for a particular file system, specifying any level causes all files in that file system to be archived.

The FileSystem parameter can specify either the physical device name (block or raw name) or the name of the directory on which the file system is mounted. The default file system is the root (/) file system.

Users must have read access to the file system device (such as /dev/hd4) in order to perform backups by i-node.

Notes:
  1. You must first unmount a file system before backing it up by i-node. If you attempt to back up a mounted file system, a warning message is displayed. The backup command continues, but the created backup may contain inconsistencies because of changes that may have occurred in the file system during the backup operation.
  2. Backing up file systems by i-node truncates the uid or gid of files having a uid or gid greater than 65535. When restored, these files may have different values for the uid and gid attributes. To retain the values correctly, always back up by name files having a uid or gid greater than 65535.
  3. You can archive only JFS (Journaled File System) file systems when backing up by i-node. Back up any non-JFS file systems by file name or by using other archive commands, such as the pax, tar, or cpio command.

Flags

-b Number For backups by name, specifies the number of 512-byte blocks; for backups by i-node, specifies the number of 1024-byte blocks to write in a single output operation. When the backup command writes to tape devices, the default is 100 for backups by name and 32 for backups by i-node.

The write size is the number of blocks multiplied by the block size. The default write size for the backup command writing to tape devices is 51200 (100 * 512) for backups by name and 32768 (32 * 1024) for backups by i-node. The write size must be an even multiple of the tape's physical block size.

The value of the -b flag is always ignored when the backup command writes to diskette. In this case, the command always writes in clusters that occupy a complete track.

-c Specifies that the tape is a cartridge, not a nine-track.
-e RegularExpression Specifies that the files with names matching the regular expression are not to be packed. A regular expression is a set of characters, meta characters, and operators that define a string or group of strings in a search pattern. It can also be a string containing wildcard characters and operations that define a set of one or more possible strings. The -e flag is applied only when the -p flag is specified.
-f Device Specifies the output device. To send output to a named device, specify the Device variable as a path name (such as /dev/rmt0 ). To send output to the standard output device, specify a - (minus sign). The - (minus) feature enables you to pipe the output of the backup command to the dd command.

You can also specify a range of archive devices. The range specification must be in the following format:

/dev/deviceXXX-YYY

where XXX and YYY are whole numbers, and XXX must always be less than YYY; for example, /dev/rfd0-3 .

All devices in the specified range must be of the same type. For example, you can use a set of 8mm, 2.3GB tapes or a set of 1.44MB diskettes. All tape devices must be set to the same physical tape block size.

If the Device variable specifies a range, the backup command automatically goes from one device in the range to the next. After exhausting all of the specified devices, the backup command halts and requests that new volumes be mounted on the range of devices.

-i Specifies that files be read from standard input and archived by file name. If relative path names are used, files are restored (with the restore command) relative to the current directory at restore time. If full path names are used, files are restored to those same names.
-L Length Specifies the length of the tape in bytes. This flag overrides the -c, -d, and -s flags. You can specify the size with a suffix of b, k, m, or g to represent Blocks (512 bytes), Kilo (1024 bytes), Mega (1024 Kilobytes), or Giga (1024 Megabytes), respectively. To represent a tape length of 2 Gigabytes, enter -L 2g . This flag only applies to AIX Version 4.2 and above.
Note: Use the -L flag for i-node backups only.
-l Number (lowercase L) Limits the total number of blocks to use on the diskette device. The value specified must be a non-zero multiple of the number of sectors per diskette track. This option applies to by-name backups only. See the format command for information on sectors per diskette track.
-o Creates a Version 2-compatible backup by name. This flag is required for compatibility with Version 2 systems because backups by name that are created by a version higher than 2 cannot be restored on Version 2 systems. To create a Version 2-compatible backup by name, use the -o flag along with other flags required for backups by name.

Files with attributes and values, such as user IDs and group IDs, that are too large for Version 2 systems will not be backed up. A message is displayed for each such file and each value that is too large.

-p Specifies that the files be packed, or compressed, before they are archived. Only files of less than 2GB are packed.
Note: This option should only be used when backing up files from an inactive filesystem. Modifying a file when a backup is in progress may result in corruption of the backup and an inability to recover the data. When backing up to a tape device which performs compression, this option can be omitted.
-q Indicates that the removable medium is ready to use. When you specify the -q flag, the backup command proceeds without prompting you to prepare the backup medium and press the Enter key to continue. This option applies only to the first volume; you are prompted for subsequent volumes. The -q flag applies only to backups by name.
-u Updates the /etc/dumpdates file with the raw device name of the file system and the time, date, and level of the backup. You must specify the -u flag if you are making incremental backups. The -u flag applies only to backups by i-node.
-v Causes the backup command to display additional information about the backup. When using the -v flag, the size of the file as it exists on the archive is displayed in bytes. Additionally, a total of these file sizes is displayed when all files have been processed. Directories are listed with a size of 0. Symbolic links are listed with the size of the symbolic link. Hard links are listed with the size of the file, which is how hard links are archived. Block and character devices, if they were backed up, are listed with a size of 0.

When the -v flag is not specified, the backup command displays only the names of the files being archived. This option is used only when backing up by file name.

-w Currently disabled. If the -w flag is specified, no other flags are applied.
-W Displays, for each file system in the /etc/dumpdates file, the most recent backup date and level. If the -W option is specified, no other flags are applied.
-Level Specifies the backup level (0 to 9). The default level is 9.

Exit Status

This command returns the following exit values:

0 Successful completion.
>0 An error occurred.

Examples

  1. To backup all the files and subdirectories in the /home directory using full path names, enter:
    find /home -print | backup -i -f /dev/rmt0
    The -i flag specifies that files will be read from standard input and archived by file name. The find command generates a list of all the files in the /home directory. The files in this list are full path names. The | (pipe symbol) causes this list to be read from standard input by the backup command. The -f flag directs the backup command to write the files to the /dev/rmt0 tape device. Because the files are archived using full path names, they will be written to the same paths when restored.
  2. To backup all the files and subdirectories in the /home/mike directory using relative path names, enter:
    cd /home
    find . -print | backup -i -v -q
    Each file name in the list generated by the find command is preceded by ./ (dot, slash). Because the files are backed up using relative path names, they will be written to the current directory when restored. The -v flag causes the backup command to display additional information about the backup. The files are written to the default backup device /dev/rfd0.
  3. To backup the / (root) file system, enter:
    backup -0 -u -f /dev/rmt0 /
    The 0 level specifies that all the files in the / (root) file system be backed up. The -u flag causes the backup command to update the /etc/dumpdates file for this backup.
  4. To backup all the files in the / (root) file system that have been modified since the last level 0 backup, enter:
    backup -1 -u -f /dev/rmt0 /
    If the /etc/dumpdates file does not have an entry for a level 0 backup of the / (root) system, all the files in the file system are backed up.
  5. To run the backup command using the System Management Interface Tool (SMIT), enter:
    smit backup

Files

/etc/filesystems Contains file system mount information.
/etc/dumpdates Specifies log for incremental by i-node backups.
/dev/rfd0 Specifies default backup device.
/dev/rhd4 Specifies device where the default file system (root) is located.
/usr/sbin/backup Contains the backup command.

Related Information

The dd command, find command, rdump command, restore command.

The dumpdates file, filesystems file, rmt special file.

The Backup Overview for System Management in AIX Version 4.3 System Management Guide: Operating System and Devices provides information on different methods of backing up, restoring process, different types of backup media, and guidelines for backup policies.

The Directory Overview in AIX Version 4.3 System User's Guide: Operating System and Devices explains working with directories and path names.

The File Systems Overview for System Management in AIX Version 4.3 System Management Guide: Operating System and Devices explains file system types, management, structure, and maintenance.

The Mounting Overview in AIX Version 4.3 System Management Guide: Operating System and Devices explains mounting files and directories, mount points, and automatic mounts.

The System Management Interface Tool (SMIT): Overview in AIX Version 4.3 System Management Guide: Operating System and Devices explains the structure, main menus, and tasks that are done with SMIT.


[ Previous | Next | Contents | Glossary | Home | Search ]