Backs up files and file systems.
To Back Up Files by Name
backup -i [ -b Number ] [ -p [ -e RegularExpression ] ] [ -E{force|ignore|warn} ] [ -f Device ] [ -l Number ] [ -U ] [ -O ] [ -o ] [ -q ] [ -v ] [ -Z ]
To Back Up File Systems by i-node
backup [ [ -Level ] [ -b Number ] [ -c ] [ -f Device ] [ -L Length ] [-n snapshotName] [ -U ] [ -O ] [ -u ] ] [ FileSystem ] | [ -w | -W ] [ -Z ]
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:
- Running the backup command results in the loss of all material previously stored on the selected output medium.
- 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.
- 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.
- Do not attempt to back up a logical volume.
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:
- 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.
- 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.
- 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) or have Backup authorization in order to perform backups by i_node.
Notes:
- 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.
- 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.
- 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.
- The -Z flag is mandatory for backing up encrypted file systems.
Item | Description |
---|---|
-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. |
-E | For backups by name, the -E option requires
one of the following arguments. If you omit the -E option, warn is the default behavior.
|
-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:
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 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 about sectors per diskette track. |
-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. Note: Use the -L flag for i-node backups only. |
-n snapshotName | Specifies the name of the internal snapshot to back up. You must mount the file system containing the snapshot. The -n flag is used for backups by the i-node only. |
-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. |
-O | Creates a non-Trusted AIX® security attributes backup. Note: The -O flag only
applies for systems running Trusted AIX.
|
-p | Specifies that the files be packed, or compressed, before
they are archived. Only files of less than 2GB are packed. Note: While using this option, it is recommended to keep the file system inactive. This option can be used on an active file system. However, if a file is modified at the time it is being backed up, there is an increased chance of the backup reporting a failure. You can omit this option while backing up to a tape device, which performs compression. |
-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 | Specifies to backup any ACLs or named extended attributes. Without this option the image will include only AIXC ACLs and PCLs in the archive along with the other regular file data. For files containing NFS4 ACLs, conversion to AIXC will happen by default during archival. |
-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. |
-Z | Backs up the Encrypted File System (EFS) information for all
of the files, directories, and file systems. The EFS information is
extracted by default. Note: Archives created with -Z option
can be restored only on AIX 6.1 or later releases.
|
On Trusted AIX systems, only users with the aix.fs.manage.backup authorization can run the backup command.
Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.
This command returns the following exit values:
Item | Description |
---|---|
0 | Successful completion. |
>0 | An error occurred. |
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.cd /home/mike
find . -print | backup -i -v -q
ls /etc/passwd | backup -ivUf arch.bk
ls /etc/passwd | backup -ivOf arch.bk
Item | Description |
---|---|
/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. |