Tar and Taper for Linux

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

Although tar is a very powerful and flexible program, it has no friendly user interface. taper provides many of the same features as tar, but provides a nice user-friendly interface.

See below for locations of the taper sources. At the time this article was written, the current version was 5.4. taper requires a recent version (1.9.6 or greater) of ncurses that supports “forms”, which can be retrieved from any GNU mirror site or from the primary GNU ftp site, prep.ai.mit.edu. It is easy to configure, build, and install for Linux; installation instructions are included in the INSTALL file. As of this writing, the current version of ncurses is 1.9.7a and can be found in the file ncurses-1.9.7a.tar.gz.

To build and install the latest ncurses, I did the following as root:

$ cd /usr/local/sr
$ tar xzf ncurses-1.9.7a.tar.gz
$ cd ncurses-1.9.7a
$ ./configure --with-normal --with-shared

  --with—debug --disable-termcap
$ make
$ make install

The steps you need to take may be slightly different; the INSTALL file gives plenty of details. The --with-shared option is especially important if you have ELF libraries and don't remove previous versions—otherwise, compiling taper may not work.

To make a binary of taper, issue the following commands:

$ tar xzf taper-xx.xx.tar.gz

where xx.xx is the the version that you have obtained. Next, you may need to edit the Makefile (e.g., if you are using a SCSI drive, remove the [cw]#[ecw] that is in front of the line -DHAVE_SCSI, or if you are using the new zftape driver, remove the # that is in front of the line -DUSING_ZFTAPE—see the Makefile for more details). Then type:

$ make clean
$ make all
$ make install

By default, the programs will have been installed in /sbin and the manual page in /usr/man/cat1. You can change these if you wish by appropriately editing the Makefile. If you do not have write permission to these directories, the files will remain in the current directory and will not be copied across.

taper Basics

Some terminology first:

archive

This describes all the files on a tape (or hard disk file). You can restore files from an archive or add files to an archive.

volume

Each archive is divided into one or more volumes. Each time you back up a set of files to an archive, a new volume is created. For example, if in one session you back up /etc, then the archive contains one volume. If you then add /usr/local/etc to the archive, another volume is created so that you still have one archive, but two volumes. Note that if you backup /etc and /usr/local/etc in one backup session, only one volume is created.

preferences

It is possible to customize various aspects of taper—everything from screen colours, to how taper behaves when it encounters soft links. Each customizable option is called a preference.

file set

It is possible to store commonly selected groups of files into a file set. For example, you may periodically want to backup only /etc, /usr/home/user1 and /usr/local/etc. Rather than having to explicitly select those directories every time you wish to make a backup, you can select them once and then save them to a file set. Subsequently, when you are making backups, you need only load in the file set to automatically select those directories.

incremental backup

taper supports two modes of backup, full backup and incremental backup. With full backup mode, all the files and directories you select are backed up. In incremental mode, taper is intelligent. If the file you have selected for backup already exists on an archive, taper will back it up only if the file has changed. If the file hasn't changed, it won't be backed up. This makes backing up large directories very quick and easy since only the changed files are backed up.

most recent restore

It is possible that you will have many copies of the same file on an archive—from old versions to the most recent version. taper can automatically detect which is the most recent and restore only that; you need not manually determine and select it.

When you create an archive, taper stores all the information about files on that archive (such as filename, file size, backup time, etc.) into a file called the archive information file. This file is stored on the hard disk in a directory (default is ~/.taper_info). In future, when accessing this archive, taper uses the archive information file to quickly gain access to all details about the archive—this speeds up performance since the tape doesn't need to be accessed.

The downside of this is that you need to make sure that this information file does not get deleted or corrupted (don't despair if it does, though, since you can recreate it). Also, if you wish to restore files on a different machine, you have to make sure that you either reconstruct the info file on the new machine, or take a copy of the info file with you on a floppy (or via an ftp transfer).

Each archive created is allocated a unique archive ID and you use that in future for accessing the archive if you don't have the tape handy.

You need to tell taper the name of the backup devices (both rewinding and non-rewinding). You can do that by giving the command line options -f (or --rewinding-device) for the rewinding device and -n (or --non-rewinding-device) for the non- rewinding device. Alternatively, you can start taper and then specify the names using the Global preferences option.

If you compiled with -DHAVE_SCSI option on, the default names are /dev/st0 (rewinding) and /dev/nst0 (non-rewinding). If you compiled with -DUSING_ZFTAPE, the default names are /dev/qftape(rewinding) and /dev/nqftape (non-rewinding). Otherwise, the default names are /dev/ftape (rewinding) and /dev/nftape (non-rewinding). It is also possible to set default names using environment variables—TAPE is the name of the rewinding device and NTAPE is the name of the non-rewinding device. Alternatively, you can use a preference file to set defaults (see below).

______________________

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