Backing up file systems, directories, and files represents 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. 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. If you carefully and methodically back up your file systems, you can always restore recent versions of files or file systems with little difficulty.
Several methods exist for backing up information. One of the most frequently used methods is called backup by name or 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 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 backs 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 which command was used to initiate the backup, and how the backup was made (by name or by file system).
backup | Backs up files by name or by file system. |
mksysb | Creates an installable image of the rootvg. |
cpio | Copies files into and out of archive storage. |
dd | Converts and copies a file. Commonly used to convert and copy data to and from systems running other operating systems, for example, mainframes. dd does not group multiple files into one archive; it is used to manipulate and move data. |
tar | Creates or manipulates tar format archives. |
rdump | Backs up files by file system onto a remote machine's device. |
pax | (POSIX-conformant archive utility) Reads and writes 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 one hundred 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 might be helpful:
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 enables 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 might 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, do not reuse all of your backup media. Sometimes it is months before you or some other user of your system notices that an important file is damaged or missing. 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 might be useless. Before making your backups, it is good policy to check the integrity of the file system with the fsck command.
Do not use the system 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.
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 tapes, diskettes, remote archives, and alternate local hard disks. 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.
After the data has been correctly 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 correctly. 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 | Copies file systems backed up on a remote machine to the local machine. |
cpio | Copies files into and out of archive storage. |
tar | Creates or manipulates tar archives. |
pax | (POSIX-conformant archive utility) Reads and writes tar and cpio archives. |