backup command

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 back up. The possible back up levels are 0 to 9. A level 0 back up archives all files in the file system.

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 back up authorization to perform backups by i_node.

Note:
  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 back up might contain inconsistencies because of changes that might have occurred in the file system during the back up 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 might have different values for the uid and gid attributes. To retain the values correctly, always back up by name those files that have 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.

Purpose

Backs up files and file systems.

Syntax

To back up files by name:

backup -i [ -b Number ] [ -p [ -e RegularExpression ] ] [ -E{force|ignore|warn} ] [ -f Device ] [ -l Number ] [ -U ] [ -o ] [ -q ] [ -v ] [ -ejt ]

To back up file systems by i-node:

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

Description

The backup command creates copies of your files on a back up medium, such as a magnetic tape or diskette. The copies are in one of the two back up formats:
  • Specific files backed up by name using the -i flag.
  • Entire file system backed up by i-node using the Level and FileSystem parameters.
If you issue the backup command without any parameters, the root file system level 9 i-node back ups to the /dev/rfd0 device. The default syntax is:
-9uf/dev/rfd0 /dev/rhd4

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

A single back up can span multiple volumes.

Note:
  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 might be compromised if a file is modified during system back up. Keep system activity at a minimum during the system back up procedure.
  3. If a back up 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.

Note:
  1. Files are restored using the same path names as the archived files. Therefore, to create a back up 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 back up 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 2 GB 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.
Note:
  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
  4. The -Z flag is mandatory for backing up encrypted file systems.

Flags

Flag name 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.

-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.
-ejt Rewinds the tape and takes the tape drive offline. This will unload the tape when appropriate. The tape must be re-inserted before the device can be used again.
-E For backups by name, the -E flag requires one of the following arguments. If you omit the -E option, warn is the default behavior.
force
Fails the back up operation on a file if the fixed extent size or space reservation of the file cannot be preserved.
ignore
Ignores any errors in preserving extent attributes.
warn
Issues a warning if the space reservation or the fixed extent size of the file cannot be preserved.
-f Device
Specifies the output device. To send output to a named device, specify the Device variable as a path name such as the following example:
/dev/rmt0
To send output to the standard output device, specify a - (minus sign). The - (minus sign) 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 8 mm, 2.3 GB tapes or a set of 1.44 MB 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 stops and requests that new volumes be mounted on the range of devices.

F  
G  
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 KB), or giga (1024 MB), respectively. To represent a tape length of 2 GB, enter -L 2g.
Note: Use the -L flag only for i-node backups.
-Level Specifies the backup level (0 to 9). The default level is 9.
-l Number Limits the total number of blocks to use on the diskette device. The value specified must be a nonzero multiple of the number of sectors per diskette track. This option applies to by-name backups only.
-o Creates a Version 2-compatible back up 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 back up 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 are not 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 smaller than 2 GB are packed.
Note: This option should only be used when backing up files from an inactive file system. Modifying a file when a back up is in progress might result in corruption of the back up and an inability to recover the data. When backing up to a tape device that 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 back up medium. 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 back up any access control list (ACL)s or named extended attributes. Without this option the image will include only AIX Classic (AIXC) ACLs and Printing Color Files (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 back up. 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 back up. 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 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 back up date and level. If the -W flag is specified, no other flags are applied.

Examples

  1. To back up all the files and subdirectories in the /home directory using full path names, type the following command:
    find /home -print | backup  -i -f /dev/rmt0

    The -i flag specifies that files will be read from standard input and archived by the 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 back up all the files and subdirectories in the /home/padmin directory using relative path names, type the following command:
    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 are 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 back up the / (root) file system, type the following command:
    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 back up all the files in the root (/) file system that have been modified since the last level 0 backup, type the following command:
    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 back up virtual optical media files from the virtual media repository, complete the following tasks:
    1. Create a file called backup_files with the names of the files to be backed up. Include the full path name.
      /var/vio/VMLibrary/media_file1
      /var/vio/VMLibrary/media_file2
      /var/vio/VMLibrary/media_filen
    2. Send the file using the backup command:
      cat backup_files | backup -i -f /dev/rmt0



Last updated: Wed, November 18, 2020