Tar and Taper for Linux

In plain English, Yusuf Nagree explains archival backup with tar and his user-friendly taper program.
Preferences

Below is a list of the more common preferences. For a complete list, see the man page.

compress

Tells taper whether to compress files it writes to an archive. Default is TRUE.

log file

Where taper logs activity to. Default is ~/.taper_log.

Klog level

The level of logging from 0 (no logging) to 3 (verbose). Default is 2.

prompt directories

Whether taper confirms before selecting directories in restore and backup. Default is FALSE.

incremental backup

Whether incremental backup is used as a default. Default is TRUE.

most recent restore

Whether, by default, taper should restore the most recent file or the file the user specifies. Default is TRUE.

exclude compress

Certain types of files can bypass the compression facility—e.g., by default, taper doesn't try to compress .gz or .gif files. This preference specifies which files not to try and compress. The preference is simply a string with the files you wish to exclude given as a space-separated list (e.g., default is .gz .gif .Z)

exclude files

Certain types of files can be excluded from the archive, even if explicitly specified—e.g., by default, taper doesn't try to back up .o files. This preference specifies which files to automatically exclude. The format is the same as the “exclude compress” preference and the default is .o ~

You can save your preferences to customize your particular setup. There are two ways to s: one is to a preference file and the second is to a command line file which can then be used to start taper in the future. Simply select the appropriate option from the main menu.

taper looks for a preference file in the following order:

  • The filename given by the -p (--preference-file) option on the command line

  • The filename given by the environment variable TAPER_PREFS

  • The file ~/.taper_prefs

  • The file /usr/local/etc/.taper_prefs

  • Internal defaults

Leading Zeros

Some tape drives write zeros to the beginning of a tape and this can cause confusion with taper, which thinks it has reached the end of the tape when it detects zeros. To find out if your tape drive does this, put a tape in the drive and run the testzero program—note that the tape will be overwritten. taper will test your tape and print the result on the screen.

If taper says that your drive writes leading zeros, you will have to run mktape on every tape before you can use it with taper.

Erasing Tapes

People using floppy tape drives have to both format and erase tapes. These users must either format tapes using DOS, OS/2 or WINDOWS or buy pre-formatted tapes. Erasing tapes is done automatically by taper.

People with SCSI tape drives generally don't need to format tapes. Some SCSI tape drives don't even need erasing (e.g., DAT). To tell taper not to erase tapes before using them, change the erase tape option in the backup preferences menu and save the preferences. Run mktape on all tapes before you use them so that taper doesn't think they are bad.

If you have a SCSI drive and are not sure whether you need to erase tapes, tell taper not to erase tapes and see what happens.

/proc File-System

Linux has support for a /proc file system. This is a directory that looks like a normal directory, but actually contains information about the current machine state. It is useful for programs like ps which can read this directory and print the information contained in it.

However, we obviously don't want to back up this directory. You can tell taper to automatically exclude this directory. Run the which_device program:

$ ./which_device /proc

and the device on which the /proc directory is mounted is printed. Most probably this is 1, in which case you don't need to do anything because this is taper's default. If it is not 1, tell taper this via the backup options or via the command line (--proc-device num).

Memory Considerations

If you have many files to backup, taper can end up using quite a bit of memory. If you wish to minimize the amount of memory taper uses while running, edit your Makefile and un-comment the line (i.e., remove the #] in front of the line):

DEFINES=-DMEMORY_TIGHT

Now, when taper runs, it will be quite memory efficient. The downside (of course, there's a downside!) will be that performance will not be as good. However, on most machines, you will not notice a performance degredation until you reach 2,000-3,000 files.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix