-->

Previous | Table of Contents | Next

Page 342

Although most tape drives will rewind a freshly inserted tape, you can use the mt, or magnetic tape command to rewind or re-tension your tape. Insert the tape, then use the following:


# mt -f /dev/ftape rewind

After the tape has rewound, erase it with the mt command's erase option:


# mt -f /dev/ftape erase

After the tape has been erased, you can write a tar archive to the tape by specifying the /dev/ftape device:


# cd /

# tar cf /dev/ftape /home

This command creates a tape archive of all the files and directories under the /home directory. To restore your tape archive, you must use the tar command's extract, or x command-line option:


# cd /

# tar xf /dev/ftape

There are many more options with the tar command. You'll want to explore some of them, such as the d option to test archives, or the z option to compress files (and save tape space). For more information, see the tar manual page and read the ftape-HOWTO under the /usr/doc directory.

Using the cpio Command to Backup and Restore

The cpio, or copy in and out command, may be used in much the same way as the tar command, but with several differences, especially with archive creation or extraction command-line options. For example, to create a cpio archive, you must use the -o, or create, option. The cpio command also requires a list of filenames, with paths, to build an archive. To do this, use the find command which handily creates the required names for you.

For example, if you have a directory called x11 that contains a number of files you'd like to archive, you can combine the output of the find command with the cpio command to build the archive.


# find x11 | cpio -ov >x11.cpio

cpio: x11: truncating inode number

x11

x11/xfree86faq.txt

x11/xappsfaq.txt

x11/x11faq.txt

x11/disaster.txt

x11/XHints1.txt

1082 blocks

Page 343

This command line shows that the cpio command has been fed the names of the files inside the x11 directory, creating an archive with the -o option and showing you the files added with the -v option. The name of the archive is x11.cpio, and it is created using the greater than, or >, redirection operator.

To restore a cpio archive, use the cpio command's extract, or -i command-line option:


# cpio -i < x11.cpio

1082 blocks

This command line shows that to extract a cpio archive you can use the less than, or <, redirection operator in conjunction with the -i cpio extract option. The cpio program re-creates the directory and finishes by printing the number of 512-character blocks that were written to your hard drive.

You also can use the combination of the find command and cpio to create archives of any directory, or even different files on your system. To back up all files in your directory that belong to you, and are less than one day old, (or have been modified in the last day), you can use the find command's -user and -mtime command-line options:


# find /home/bball -user bball -mtime -1 -print | cpio -o >today.cpio

This command line creates a cpio archive, called today.cpio, which contains all the files you've modified in the last 24 hours. You're only limited by your imagination in how to devise your backups, and how to back up your system. For more information on the cpio command, read its manual page. For more information about the find command, see Hour 5, or read the find manual page.

Using the taper Script for Tape Drive Backups and Restores

The taper program, by Yusaf Nagree, is a backup and restore program used to create compressed or uncompressed archives of selected files or directories. This program provides a nice interface to creating and maintain tape archives. You also may use other types of media to do your backups.

Using the taper command is easy. Specify the type of media to use with the -T media option. According to the latest documentation, the taper command supports the following:

If you don't have a tape drive, but would like to try the taper program to test a backup of

Page 344

a directory or two to floppy diskettes, use the -T command-line option with the removable option:


# taper -T removable

This starts the taper program, using the default floppy device, /dev/fd0. You'll be asked to select the files or directories before you start the backup. The taper program has too many features to discuss here, but you'll find its documentation under the /usr/doc directory in the file TAPER.txt.

Configuring the BRU Backup System for Backups and Restores

If you purchase Linux from Red Hat Software, a copy of Enhanced Software Technologies' BRU, or Backup and Restore Utility, is on your CD-ROM (see Figure 23.1). This is a complete commercial software backup application you can use to back up your system or files, using nearly any tape drive and even floppies. This section shows you some of the highlights of this software, which provides data verification, error detection, data compression, and selective backup and restores. You can use the BRU software from the command line or while using X11.

Install the BRU software from your CD-ROM either during the initial install, or later on, using the control-panel or glint commands (see Hour 22, "Red Hat Tools"). When you first

Figure 23.1.
The BRU 2000 backup
and restore utility
features menus and
buttons to manage
Linux system backups.


run BRU, you must also tell BRU which device to use to back up your files.

First, go to the File menu and choose Configure BRU. The BRU Configuration Utility window appears. Click the Devices button in this window, then click New. A New Device

Previous | Table of Contents | Next