Once your system is in use, your next consideration should be backing up file systems, directories, and files. Files and directories represent a significant investment of time and effort. At the same time, all computer files are potentially easy to change or erase, either intentionally or by accident. If you take a careful and methodical approach to backing up your file systems, you should always be able to restore recent versions of files or file systems with little difficulty. When a hard disk crashes, the information contained on that disk is destroyed. The only way to recover the destroyed data is to retrieve the information from your backup copy.
Several different methods exist for backing up information. One of the most frequently used methods is called backup by name, also called file name archive. This method of backup is done when the i flag is specified and is used to make a backup copy of individual files and directories. It is a method commonly used by individual users to back up their accounts.
Another frequently used method is called backup by file system, also called backup by i-node or file system archive. This method of backup is done when the i flag is not specified. It is used to make a backup copy of an entire file system and is the method commonly used by system administrators to back up large groups of files, such as all of the user accounts in /home. A file system backup allows incremental backups to be performed easily. An incremental backup will back up all files that have been modified since a specified previous backup.
The compress and pack commands enable you to compress files for storage, and the uncompress and unpack commands unpack the files once they have been restored. The process of packing and unpacking files takes time, but once packed the data uses less space on the backup medium.
Several commands create backups and archives. Because of this, data that has been backed up needs to be labeled as to what command was used when doing the backup, and how the backup was made (by name or by file system). The backup command is the most frequently used, but other commands serve specific purposes:
backup | Backs up files by name or by file system. |
mksysb | Creates an installable image of the rootvg volume group. |
cpio | Copies files into and out of archive storage. Can usually read data archived on another platform provided it is in cpio format. |
dd | Converts and copies a file. Commonly used to convert and copy data to and from non-AIX systems, for example, mainframes. dd does not group multiple files into one archive; it is used to manipulate and move data. |
tar | Manipulates tar format archives. |
rdump | A network command that backs up files by file system onto a remote machine's device. |
pax | POSIX-conformant archive utility that can read and write tar and cpio archives. |
No single backup policy can meet the needs of all users. A policy that works well for a system with one user, for example, could be inadequate for a system that serves five or ten different users. Likewise, a policy developed for a system on which many files are changed daily would be inefficient for a system on which data changes infrequently. Whatever the appropriate backup strategy for your site, it is very important that one exist and that backups be done frequently and regularly. It is difficult to recover from data loss if a good backup strategy has not been implemented.
Only you can determine the best backup policy for your system, but the following general guidelines should help:
Can your system continue to run after any single fixed disk failure? Can you recover your system if all the fixed disks should fail? Could you recover your system if you lost your backup diskettes or tape to fire or theft? If data were lost, how difficult would it be to re-create it? Think through possible, even unlikely, major losses, and design a backup policy that would enable you to recover your system after any of them.
Backup media and their hardware can be unreliable. A large library of backup tapes or diskettes is useless if data cannot be read back onto a fixed disk. To make certain that your backups are usable, display the table of contents from the backup tape periodically (using restore -T or tar -t for archive tapes). If you use diskettes for your backups and have more than one diskette drive, read diskettes from a drive other than the one on which they were created. You may want the security of repeating each level 0 backup with a second set of media. If you use a streaming tape device for backups, you can use the tapechk command to perform rudimentary consistency checks on the tape.
Develop a regular cycle for reusing your backup media; however, you should not reuse all of your backup media. Sometimes it may be months before you or some other user of your system notices that an important file is damaged or missing. You should save old backups for such possibilities. For example, you could have the following three cycles of backup tapes or diskettes:
A backup made from a damaged file system may be useless. Before making your backups, it is good policy to check the integrity of the file system with the fsck command.
Your system should not be in use when you make your backups. If the system is in use, files can change while they are being backed up, and the backup copy will not be accurate.
It is always good policy to back up your entire system before any hardware testing or repair work is performed or before you install any new devices, programs, or other system features.
Note: The backup of named pipes (FIFO special files) works fine whether they are closed or open. However, the restoration fails when the backup is done on open named pipes. When restoring a FIFO special file, its inode is all that is required to recreate it since it contains all its characteristic information. The content of the named pipe is not relevant for restored. Therefore, the file size during backup should be zero (all the FIFOs closed) before the backup is made.
Attention: System backup and restore procedures require that the system be restored on the same type of platform from which the backup was made. In particular, the CPU and I/O planar boards must be of the same type. The backup and restore procedures described herein were tested for operation on the IBM RS/6000 platform and may not operate as described on other platforms.
Several types of backup media are available. The types of backup media available to your specific system configuration depend upon your software and hardware. The types most frequently used are 8-mm tape, 9-track tape, and the 3.5-inch diskette.
For backing up individual files and file systems, diskettes are the standard medium. Unless you specify a different device using the backup -f command, the backup command automatically writes its output to /dev/rfd0, which is the diskette drive. To back up to the default tape device, use /dev/rmt0.
Attention: Running the backup command results in the loss of all material previously stored on the selected output medium.
Once data has been properly backed up, there are several different methods of restoring the data based upon the type of backup command you used.
You need to know how your backup or archive was created to restore it properly. Each backup procedure gives information about restoring data. For example, if you use the backup command, you can specify a backup either by file system or by name. That backup must be restored the way it was done, by file system or by name.
Several commands restore backed up data, such as:
restore | Copies files created by the backup command. |
rrestore | Network command that copies file systems backed up on a remote machine to the local machine. |
cpio | Copies files into and out of archive storage. |
tar | Manipulates archives. Used only for directories. |