Lemur zaprasza
Red Hat® Linux 6 Unleashed
Chapter 23: Backup and Restore Previous
Sections in this Chapter: Successful Backup Considerations Backup Strategies and Operations Qualities of a Good Backup Restoring Files Selecting a Backup Medium What Is on the Tape? Selecting a Backup Tool Previous SectionNext Section Backup Strategies and Operations Performing Backups with tar and cpio Performing Backups with the taper Script Performing Backups with BRU-2000 The simplest backup strategy is to copy every file from the system to a tape. This is called a full backup. Full backups by themselves are good for small systems, such as those typically used by Red Hat Linux users. The downside of a full backup is that it can be time-consuming. Restoring a single file from a large backup such as a tape archive can be almost too cumbersome to be of value. Sometimes a full backup is the way to go, and sometimes it is not. A good backup and recovery scheme identifies when a full backup is necessary and when incremental backups are preferred. Note - If you use your Red Hat Linux system for business, you should definitely have a backup strategy. Creating a formal plan to regularly save critical information, such as customer accounts or work projects, is essential to avoid financial disaster. Even more important: After you devise your backup plan, stick to it! Incremental backups tend to be done more frequently. With an incremental backup, only those files that have changed since the last backup are backed up. Therefore, each incremental builds upon previous incremental backups.UNIX uses the concept of a backup level to distinguish different kinds of backups. A full backup is designated as a level 0 backup. The other levels indicate the files that have changed since the preceding level. For example, on Sunday evening you might perform a level 0 backup (full backup). Then on Monday night you would perform a level 1 backup, which backs up all files changed since the level 0 backup. Tuesday night would be a level 2 backup, which backs up all files changed since the level 1 backup, and so on. This gives way to two basic backup and recovery strategies. Here is the first: Sunday Level 0 backup Monday Level 1 backup Tuesday Level 1 backup Wednesday Level 1 backup Thursday Level 1 backup Friday Level 1 backup Saturday Level 1 backup The advantage of this backup scheme is that it requires only two sets of backup media. Restoring the full system from the level 0 backup and the previous evening's incremental can perform a complete restore. The negative side is that the amount backed up grows throughout the week, and additional media might be needed to perform the backup. Here is the second strategy: Sunday Level 0 backup Monday Level 1 backup Tuesday Level 2 backup Wednesday Level 3 backup Thursday Level 4 backup Friday Level 5 backup Saturday Level 6 backup The advantage of this backup scheme is that each backup is relatively quick. Also, the backups stay relatively small and easy to manage. The disadvantage is that it requires seven sets of media. Also, you must use all seven sets to do a complete restore.When deciding which type of backup scheme to use, you need to know how the system is used. Files that change often should be backed up more often than files that rarely change. Some directories, such as /tmp, never need to be backed up. Performing Backups with tar and cpio A full backup with tar is as easy as this: $ tar -c / An incremental backup takes a bit more work. Fortunately, the find command is a wonderful tool to use with backups to find all files that have changed since a certain date. It can also find files that are newer than a specified file. With this information, it is easy to perform an incremental backup. The following command finds all files that have been modified today and backs up those files with the tar command to an archive on /dev/rmt1: $ tar c 'find / -mtime -1 ! -type d -print' The ! -type d says that if the object found is a directory, don't give it to the tar command for archiving. This is done because tar follows the directories, and you don't want to back up an entire directory unless everything in it has changed. Of course, the find command can also be used for the cpio command. The following command performs the same task as the preceding tar command: $ find / -mtime -1 | cpio -o >/dev/rmt1 As mentioned, the find command can find files that are newer than a specified file. The touch command updates the time of a file; therefore, it is easy to touch a file after a backup has completed. Then, at the next backup, you simply search for files that are newer than the file you touched. The following example searches for files that are newer than the file /tmp/last_backup and performs a cpio to archive the data: $ find / -newer /tmp/last_backup -print | cpio -o > /dev/rmt0 With tar, the same action is completed this way: $ tar c1 'find / -newer /tmp/last_backup -print' Note - You will want to touch the file before you start the backup. This means you have to use different files for each level of backup, but it ensures that the next backup gets any files modified during the current backup. Performing Backups with the taper Script The taper script (/usr/sbin/taper), included with Red Hat Linux, is a backup and restore program with a graphical interface you can use to maintain compressed or uncompressed archives on tapes or removable media (even over a network!). Using taper is easy; the format of a taper command line looks like this: # taper <-T tape-type> <option> <device> You first need to decide what type of device (or media) you'd like to use with taper. This program supports a number of devices, which are listed in Table 23.2 along with the command lines to use. TABLE 23.2 Device Support by taper Device Type Command Line /dev/zftape Floppy tape driver # taper -T z /dev/ht0 IDE tape driver # taper -T i file File on hard disk # taper -T l /dev/ftape Floppy tape driver # taper -T f /dev/fd0 Removable floppy drive # taper -T r /dev/sda4 Removable Zip drive -# taper -T r -b /dev/sda4 (-b denotes the device and archive file) /dev/sda SCSI tape drive # taper -T s After you start taper from the command line of your console or an X11 terminal window (you must be the root operator), you'll see a main menu of options to back up, restore, re-create, verify, set preferences, or exit, as shown in Figure 23.1. FIGURE 23.1 The taper script offers a graphical interface to back up and restore operations for Linux. Navigate through taper's menus with your up or down arrow keys and press the Enter key to make a selection. If you're not sure what keys to use, press the question mark (?) to have taper show a concise Help screen. Start the backup process by selecting files or directories for your backup. First, highlight the Backup Module menu item and then press the Enter key. The taper script checks the status of the device you've specified on the command line and then looks for an existing tape archive on the device. If none is found, taper asks you to name the volume and then give a name for the new archive. You'll then see a directory listing similar to that in . FIGURE 23.2 The taper script offers selective backup and restoration of your directories or files. Next, navigate through the listings or directories, using the i or I key to select files or directories to back up. When you finish, press the f or F key to start backing up your files. The taper script has many features and can be customized through preference settings in its main menu. For detailed information, see its documentation under the /usr/doc/taper directory. Performing Backups with BRU-2000 Red Hat Linux users who purchase the commercial distribution of Red Hat Linux will find a copy of Enhanced Software Technologies' BRU-2000-PE on an "Enhanced Linux Application" CD-ROM. BRU-2000-PE is a "personal edition" of a more complete, commercial network backup and restore program that features l Command-line or graphical interface for
Error detection during
Data integrity verification
Backup
Built-in
Automatic recognition of
Background mode (so
software includes two commands: bru for backing up from the console and xbru for a graphical interface during X11 sessions. BRU-2000 uses several files and directories on your Linux file system. Much of the graphical interface support is found under the /usr/lib/bru directory, and the support file /etc/brutab is used to specify different backup devices.The BRU-2000-PE software is installed by using the rpm or glint command (or during an initial installation of the commercial version of Red Hat Linux). To do a full or incremental backup of your system, you must run BRU-2000 as the root operator. To use the graphical interface version, start the program by typing xbru at the command line of an X11 terminal window to see the main dialog box, as shown in . Note - Updated software of the X11 BRU-2000 interface is available at or through . FIGURE 23.3 The BRU-2000 program is a commercial backup and restore program for nearly 20 operating systems, including Linux. The program first checks the status of the default backup device, but you can configure the program to use one of more than 37 different devices for backup. You can also define new devices, such as Iomega Zip drives, to use for storing tape archives. To configure BRU-2000 to use a Zip disk as a backup device, select the Configure BRU menu item from the File menu. A new dialog box appears, as shown in . FIGURE 23.4 To configure a new backup device for BRU-2000, select the Devices tab in its Configuration dialog box. Note - If you have an older version of BRU-2000, check for important updated device table files such as jazzip.fix and zip.bt. You'll need them to use an Iomega Zip or Jaz disk with BRU-2000. First, you should add the following lines to the file /usr/lib/bru/unmounttape.tcl: if [string match "/dev/hd*" $device] { exit 0 } if [string match "/dev/sd*" $device] { exit 0 } Select the Devices tab and then select the New button. A New Device window appears, as shown in . Type in the name of your Zip disk's device (for example, /dev/sda4), select the Device type as OTHER, and press the Create button. You can then type in a description of your Zip drive in the Device Name field and set the size of the device as 95MB. Press the Save button, followed by the Exit button. FIGURE 23.5 The New Device dialog box is used to select a new backup device or create a new one for BRU-2000. To select which files or directories to back up, either select Backup from the File menu or press the top button in BRU-2000's main dialog box (as shown in ). A directory and file selection dialog appears, as shown in Figure 23.6. You can then choose the files or directories by highlighting the name and then pressing the Add button. When finished, press the Start Backup button to begin operation. If you want to use file compression or set other options, use the Options button before backing up. FIGURE 23.6 BRU-2000 offers numerous backup options and a selective file and directory backup dialog box. BRU-2000 has many options and features. After you finish your backup, you can restore your archive, test its integrity, and even view the contents of your archives. For more details, read BRU-2000's bru command man page, check the /bru directory after installation, or browse to . Red Hat® Linux 6 Unleashed
Chapter 23: Backup and Restore Previous
Sections in this Chapter: Successful Backup Considerations Backup Strategies and Operations Qualities of a Good Backup Restoring Files Selecting a Backup Medium What Is on the Tape? Selecting a Backup Tool Previous SectionNext Section © Copyright Macmillan USA. All rights reserved. |