United States-English |
|
|
HP-UX System Administrator's Guide: Routine Management Tasks: HP-UX 11i Version 3 > Chapter 3 Managing SystemsBacking Up Data |
|
One of the most important goals of system administration is to protect the integrity of the valuable data on a system. There are several aspects to this (for example, securing the system against intruders, and protecting the system's data against deliberate or accidental removal). Many things (for example device failure) can cause data loss, and there are many tools to insure you can recover valuable data in the event of a loss of the primary copy:
This section deals with data backups. For additional information on the other ways of protecting your data (mentioned above), see Appendix A. There are many utilities to back up your data to offline media (for example, optical media or magnetic tape such as DLT cartridges). Table 3-3 compares several commonly used utilities based on many important backup criteria. This discussion focuses on the file backup and file recovery procedures of fbackup, OmniBack II, tar, and cpio. Online backup of a JFS snapshot file system is also explained. Refer to the HP-UX Reference for information on the other backup and restore utilities: dump, ftio, pax, restore, rrestore, vxdump, and vxrestore. The following topics are described in this section: When you evaluate which media to use to back up your data, consider the following:
Use Table 3-2: “Criteria for Selecting Media ” to help you determine which storage device to use for your backups. This table compares the supported device types relative to each other; it does not give specific values. For detailed information, consult the documentation that came with your tape or disk drive for capacity information about the storage media. Table 3-2 Criteria for Selecting Media
There are a number of different backup methods you may wish to choose from depending on your system backup needs and your workgroup configurations. Some recommended backup methods are: If you are backing up large numbers of systems, the HP Omniback II software product can be particularly useful. HP Omniback II is faster than other backup methods and provides for unattended backup as well. It allows you to efficiently centralize and administer backup procedures. Using HP Omniback II involves setting up a database server and running Omniback software that directs and records the backup process for clients. For a detailed description, see the HP OpenView Omniback II Administrator’s Guide. Table 3-3 compares several HP-UX backup utilities based on selected tasks. For details about specific commands, see the associated manpage. Table 3-3 A Comparison of HP-UX Backup/Recovery Utilities
To restore your system after a complete loss of data, you will need copies of the following:
If you are backing up using the fbackup command, you must define which directories and files you want to back up:
Evaluate the applications running on your system and the needs of your users to determine how critical the data on your system is to them. Consider the following: Once you have identified a list of files to include and exclude, decide whether you want all of the files represented by your list to be backed up (a full backup) or only those files that have changed or that have been created since the last time you backed up this set of files (an incremental backup). A backup level is a level you define that identifies the different degrees of incremental backups. Each backup level has a date associated with it that indicates when the last backup at that level was created. You can have up to ten backup levels (0 through 9). For example, level 0 is a full backup; level 1 backs up files that changed since the last level 0 backup; level 2 backs up files that changed since the last level 1 backup, and so on. This brings up the question, “how does fbackup know when the previous backup was created?” This information is contained in the file /var/adm/fbackupfiles/dates, a file that is updated only when all of the following conditions are true:
Backup levels are a way of specifying varying degrees of incremental backup. For example, suppose you wanted to set up the following backup schedule:
There are three “layers” (levels) associated with the above schedule (the once per month level, the once per week level, and the once per day level). The once per month level is a full backup. The other two are incremental backups. The problem is how to distinguish between the two types of incremental backup. This is accomplished with backup levels. The file /var/adm/fbackupfiles/dates contains information about when the last backup at each backup level was performed. This information is used by fbackup, along with the modification date stamps on the files themselves, to determine which files in the specified set are to be included with the backup that is currently being created. As previously stated, you can have up to 10 backup levels. When you run fbackup, you can tell it which level to use. fbackup will use the level you give it as follows:
Assume you want the following three backup levels: There are three ways you can implement these levels: use HP SMH, enter the fbackup command and specify a backup level on the command line, or automate the commands (see “Setting Up an Automated Backup Schedule”). The figure below illustrates the level numbers for implementing this example.
If your data becomes corrupt on Thursday the 12th, do the following to restore your system to its Wednesday the 11th state:
For information on the actual method and commands to restore these tapes, see “Restoring Your Data”. The /usr/sbin/fbackup command is the recommended HP-UX backup utility. The fbackup command can do the following:
To use the fbackup(1M) command:
If you use the fbackup command, an index is written at the beginning of each tape listing all files in the graph file being backed up. However, since this index is written before the files are actually backed up, if a file is removed after the index is written but before the file is backed up to tape (or something else happens that prevents the file from being backed up), the index will not be completely accurate. If you tell fbackup to make an online index file (using the -I option), it will create the file after the backup is complete. Therefore, the only index that will be accurate is the online index, which is produced after the last volume has been written (the index created using the fbackup -I option). Also, fbackup assumes all files remaining to be backed up will fit on the current tape for the index contained on that media. Therefore, if you did not use the -I option on fbackup or removed the index file, extract an index from the last media of the set. Use the /usr/sbin/frecover utility to list the contents of the index at the beginning of a backup volume made with fbackup. For example, the command frecover -I /tmp/index2 -f /dev/rmt/0m specifies that the device file for the magnetic tape drive is /dev/rmt/0m and you want to put the listing of the index in the file /tmp/index2. When backing up files that are NFS mounted to your system, fbackup can only back up those files having “other user” read permission unless you have superuser capability. (To recover the files, you will need “other user” write permission.) To ensure the correct permissions, log in as superuser on the NFS file server and use the root= option to the /usr/sbin/share command to share the permissions, then back up as root. For more information, see share(1M) and the NFS Administrator’s Guide. Here are a series of examples showing a variety of ways that fbackup can be used. Example: Backing Up to a DDS (DAT) TapeFor this example, we want to do a full backup and do not care about doing future incremental backups. Therefore, we do not need to specify a backup level (nor do we need to use the -u option to update the dates file). We could also specify “level 0” to indicate a full backup. Example: Backing Up to a DLT Tape(You plan to do a future incremental backup.) This example will back up the entire structure except the invoices directory. The device file for this example is /dev/rmt/1h, specified using the -f option. For this example, we need to plan for the incremental backup (next example), so we must do three things:
Because this will be a full backup, we’ll use the backup level 0. Any backup level would do as long as it is the lowest backup level in use. See “Backup Levels” for details about how backup levels are interpreted by fbackup. The graph file for this example will be /var/adm/fbackupfiles/graphs/g1 and its contents will look like:
The fbackup command to accomplish the above is:
Example: Incremental Backup to a DLT TapeThis example is an extension of the previous one. All characteristics of the previous example will remain the same except that this will be an incremental backup at a point in time following the previous example’s backup. We’ll use the backup level 5. The exact number is not critical as long as it is higher than the level used in the previous example. See “Backup Levels” for details about how backup levels are interpreted by fbackup.
Example: Backing Up to Two DevicesThis example will show how it is possible to specify more than one device to receive the output from fbackup. When more than one device is specified, the second one is written to when the media on the first device has filled up. If the media on the first device fills up and the remaining data to be backed up will fit on the media on the second device, an unattended backup is possible. With only one device, a media change would be required in this situation. Also in this example, an index file will be created called /tmp/index. An index is written to the beginning of each tape, listing all files in the specified “graph” being backed up. However, if a file is removed after the index is written but before the file is backed up to tape (or something else happens that prevents the file from being backed up), the index will not be completely accurate. If you tell fbackup to make an online index file (using the -I option), it will create the file after the backup is complete. Therefore, the online index file will be completely accurate with respect to which files are on each volume of the backup. For example to back up every file on the entire system to the two magnetic tape drives represented by device files /dev/rmt/0m and /dev/rmt/1m, enter:.
You would typically use both tape drives in the same tape density mode. If you are administering a workgroup, it is likely that only some of the systems in the workgroup will have storage devices such as tape drives or optical disk drives attached locally. In this situation you will need to perform remote backups. To perform a remote backup using fbackup, enter:
For information on recovering files remotely using the frecover command, see “Restoring Your Data”.
If the relative path is root (/), then you will perform a full backup. The /tmp/index file is an index file of the backup. The -v option causes the output to be written to standard error. To perform a remote backup using tar, enter:
For information on restoring files remotely using the tar command, “Restoring Your Data”. If possible, use HP SMH to set up an automated backup schedule. If you use HP-UX commands, you can automate your backup procedure using the crontab utility, which uses with cron, the HP-UX process scheduling facility. For details, see cron(1M) and see crontab(1). Use the crontab utility to specify an input file containing information about the backup procedures you want to automate. The crontab utility allows you to specify an input file containing the date, time, and run-strings of the backup procedures (processes) that you want to automate. This file (the input to the crontab utility) contains lines that have six required fields each. The fields are separated by spaces or tabs. Each entry in this file has the following format: minutes hours dates months days runstring
Therefore, to schedule the ps command (see ps(1)) to execute at 5:10 p.m. (17:10) on every Friday and Monday during June, July, and August, you would make an entry in your crontab input file that looks like this:
When using crontab, redirect any output that is normally sent to the terminal to a file. In this example, 2>&1 redirects any error messages to the file psfile. An example backup strategy may consist of a full backup (performed once per week) and an incremental daily backup. Assume that the backups are to be performed at 4:03am and the media is DDS (DAT) tape. The following crontab file implements the example backup strategy:
In the above example incrback and fullback are example shell scripts. Be sure to set the PATH variable appropriately or use complete paths to any scripts that you include in the crontab input file. Scripts like these may be used to:
The output redirection can be specified in the crontab input file or within the script contained in the crontab input file.
To list your currently scheduled processes, enter:
This displays the contents of your activated crontab input file. Before you activate a new crontab input file, you should view the currently scheduled processes (see “Displaying an Automated Backup Schedule”). Consider adding these processes to your crontab input file. To activate all of the processes defined in your crontab input file and cancel any previously scheduled processes not defined in your crontab input file, enter:
After your crontab backup has been activated, make sure that:
If you are running LVM, you must maintain the backup configuration files for each volume group. After making changes to the configuration of the disks or the logical volumes within a given volume group, the vgcfgbackup command is run automatically to record the group’s configuration (vgcfgbackup saves the configuration of each volume group in /etc/lvmconf/volume_group_name.conf). To ensure recovery of LVM information following disk corruption, you must back up both the /dev and /usr directories. Include the /usr directory in the root volume group during your backup. If, however, the /usr directory was not originally part of the root volume group, you can still create a new logical volume in the root volume group and move the /usr directory within it. For information on saving volume group configuration information using vgcfgbackup, see HP-UX System Administrator’s Guide: Logical Volume Management. A large file is defined as one whose size is greater than 2 GB. See the HP-UX Large Files White Paper Version 1.4 for more information. The following backup utilities will back up large files. Neither of the preceding commands require any user intervention to backup large files. The following backup utilities do not support large files: Attempts to back up any files greater than 2 GB using the preceding utilities will fail. If you use fbackup to back up large files (> 2 GB), then those files can only be restored on a large file system. For instance, suppose that you back up a file system containing large files; you cannot restore those files to a file system that is not enabled for large files. If a backup contains large files and an attempt is made to restore the files on a file system that does not support large files, the large files will be skipped.
The Journaled File System (JFS) enables you to perform backups without putting the file system off-line. You do this by making a snapshot of the file system, a read-only image of the file system at a moment in time. The primary file system remains online and continues to change. Once you create the snapshot, you back it up with any backup utility except dump.
|
Printable version | ||
|