Linux
by Tim Parker
IN THIS CHAPTER
- What Is Lone-Tar?
- Using Lone-Tar's Interface
- Installing Lone-Tar
- Backing Up with Lone-Tar
- Verifying Files
- Restoring Files
- Utilities and Environment: Tweaking Lone-Tar
As you saw in Chapter 38, "System Administration Basics," making backups
on your Linux system can be a complex and often annoying procedure, especially if
you don't have a high-capacity tape drive or other backup storage device. If you
have to rely on floppies for a backup, you are really in for a frustrating time,
because a full backup can take dozens (if not hundreds) of disks. When floppies are
all that's available, most users don't even bother.
Many users find the normal backup utility tar difficult and unfriendly to work
with. On top of that, tar can error out for any number of conditions, causing you
to have to restart your backup from the beginning. In many larger UNIX environments,
the use of tar has been replaced by custom-designed GUI-driven backup utilities,
but Linux hasn't quite caught up to that point yet. There are, however, a few alternatives
to using straightforward tar, and the best of these is Lone Star Software's Lone-Tar.
An evaluation copy of Lone-Tar has been graciously provided by Lone Star Software
on the CD-ROM accompanying this book. It's definitely worth trying out!
Lone-Tar can best be thought of as a super version of tar. It provides all the
features of tar yet adds some functionality that tar lacks. To be very safe, Lone-Tar
does not use the standard tar utility, although its behavior is similar. Lone-Tar
is available for many UNIX and non-UNIX platforms and is compatible across them all.
You could, for example, use a DOS version of Lone-Tar to back up files to a tape,
and then read them into your Linux system.
Like tar, Lone-Tar can back up and restore entire file systems to and from disks,
tape, auxiliary hard disks, and other storage media. Lone-Tar goes beyond normal
tar in that all special files, links (symbolic and otherwise), virtual files, and
partitions can be handled as easily as standard files.
Lone-Tar can also allow backups and restores of dual drives with different capacities,
which tar is not easily capable of doing. Most important, Lone-Tar has an excellent
error-recovery procedure built in that allows recovery of a file system or files
on a backup medium, even when that medium has developed errors. When tar encounters
problems with a backup medium, it terminates, effectively ruining the value of that
backup set.
-
NOTE: Lone-Tar sounds
pretty handy so far, doesn't it? I've used Lone-Tar for years on my UNIX systems,
and the availability of a Linux version makes it almost a necessary part of every
Linux installation I set up. Lone-Tar is a commercial product. Lone Star Software
expects to be paid for Lone-Tar, but you can use the free version on the CD-ROM at
the back of this book for up to a year without worrying. After that trial period,
you can purchase a license for Lone-Tar if you find it valuable and useful. Along
with the commercial version, you'll also get a well-written manual. For more information
on Lone-Tar, contact Lone Star Software at 13987 W. Annapolis Court, Mt. Airy, MD
21771; by telephone at (800) LONE-TAR; or by Internet at cowboy@cactus.com,
http://www.cactus.com, or ftp.cactus.com.
Lone-Tar has two interfaces: menu-driven and command line. The command-line interface
is very similar to the tar command's syntax for compatibility's sake. This way, someone
who has been using tar for many years and moves to Lone-Tar for the extra capabilities
it offers doesn't have to relearn a whole new command set. As you might have discovered
by now, tar's command set is rather uninspiring, awkward, and difficult to master.
It does take years of use to feel comfortable with tar's command line, so for
that reason Lone Star Software designed a friendlier menu-driven interface too. You
can use either the command line or the menu-driven interface to perform all of Lone-Tar's
functions, and they work the same. The menu-driven interface is much easier to work
with, though, especially if you haven't mastered tar.
You can see the difference between the two interface methods by a quick look at
the syntax of Lone-Tar. The syntax, very similar to tar's syntax, looks like this:
lone-tar [MIcCrtTUxPZ] [bdefhklmnpvFEADVR] [tapefile] [block size]
 [compression limit] [0-9] [floppy/tape size] files ...
If you are not exactly right with one of the command-line parameters, both tar
and Lone-Tar give you pages of error codes and options. You can display the command-line
help screen, shown in Figure 67.1, at any time by simply typing
lone-tar
at the command line.
The menu-driven interface, on the other hand, shown in Figure 67.2, is much more
friendly and easier to figure out. Each of the primary menu options leads to another
menu, with mnemonic startup commands for each choice.
The choice of interface you use is up to you, of course, but if you are not familiar
with tar's awkward syntax, you should stick to the menu-driven interface. UNIX veterans
might want to stay with the command-line interface, but the menu-driven system is
much easier to work with and eliminates the chance of typing errors. For most of
this chapter, we'll work with the menu-driven interface.
FIGURE
67.1. The first page of command-line help
from Lone-Tar.
FIGURE
67.2. The menu-driven interface from Lone-Tar
is much easier and friendlier to use than the command line.
The installation process for Lone-Tar is pretty simple. You need to log in as
root, and then change to the /tmp directory. You then should extract all
the files from the CD-ROM or disk (if you have put the Lone-Tar software on the disk)
with a tar command. For example, if you have copied the Lone-Tar files to
a floppy in drive A, you would log into the system as root and issue the following
two commands:
cd /tmp
tar xvf /dev/rfd0
The tar command tells Linux to extract all the files from the first floppy
drive (/dev/rfd0) and store them in the current directory.
-
NOTE: Some Linux systems
don't address the first floppy as /dev/rfd0 but prefer /dev/fd0.
If you get a message about "device unknown" when you use the command line
shown previously, use /dev/fd0 as the floppy device name instead.
If you are installing from CD-ROM, you can copy the files to the /tmp
directory directly using cp. For example, if the files are stored on the
CD-ROM in the directory /lone-tar and the CD-ROM is mounted to your Linux
system in the directory /cdrom, you would issue these commands:
cd /tmp
cp /cdrom/lone-tar/*
The exact command line you use depends on the location of the Lone-Tar files on
the CD-ROM and the mount location on your system.
-
NOTE: For more information
on mounting the CD-ROM on your Linux system, see Chapter 38 or the installation chapters.
After the files are all safely in the /tmp directory, you can start the
installation process by issuing this command:
./init.ltar
This program was written by Lone Star Software to install all the components of
Lone-Tar properly. You are asked a bunch of questions about your tape or backup drive,
its capacity, and whether you want to print the online manuals. If you don't want
to print the manuals during the installation process, you can print them at any time
from the Lone-Tar menu.
To start the Lone-Tar system in menu-driven mode, issue the following command:
ltmenu
You should then see a screen like the one shown in Figure 67.3. Pressing Enter
takes you to the main menu, shown previously in Figure 67.2. If you want to use your
Lone-Tar system in command mode, use the command
lone-tar
followed by any options, or by itself to display the help screen shown earlier
in Figure 67.1.
FIGURE
67.3. If Lone-Tar was installed
correctly, you should see this welcome screen when you start the menu mode.
Backups are a vital part of any Linux system, whether you use your system for
serious work or just for playing. The reason is simple: Reloading your Linux system,
reconfiguring it the way it was, and reloading all your applications can take a long
time and can sometimes lead to errors. Recovering from a backup tape or other backup
device can take a few minutes and requires little intervention on your part. If you
have important information stored on your Linux system, you really should have regular
backups made for safety's sake, because it's often impossible to reconstruct data
you lost.
-
NOTE: If you are forced
to use floppies for your backups, you should use the Floppy choice from the main
Lone-Tar menu. This option leads to the Floppy menu, which lets you back up and restore
using your floppy drives rather than a tape drive.
Lone-Tar lets you make two kinds of backups: Masters and Incrementals. The Master
backup is a complete backup of your system, with every file on the file systems backed
up safely. An Incremental backup is made between Masters and holds the changes to
the system since the last Master. Incremental mode lets you make backups much quicker,
because there is no need to back up every file. Linux knows which files have changed
because of the attributes attached to each file, and the files that have been created
or modified since the last Master backup are written to the backup medium. In case
of a problem and a reload, the Master is reloaded first, and then the Incrementals
made since the Master. If you've lost a file or two, you can often get them from
the Incremental itself.
The manner in which you create Master and Incremental backups will depend on how
much you use your system, how much data you change daily, and how important your
system is to you. For example, a regularly used system could get a Master backup
once a week to a high-capacity drive. Incrementals could be performed automatically
each night.
If you don't use your system much, you can do Master backups once a month and
Incrementals weekly, although this isn't really recommended. For heavily loaded systems,
you might want to forget about Incrementals altogether and make a new Master backup
every night. One of Lone-Tar's strengths is the capability to automate backups, as
you will see.
To start a Master backup, choose the M option from the main menu. You
are asked whether you want to exclude any file systems, as shown in Figure 67.4.
By default, Lone-Tar assumes that it will back up everything on your system, but
you might want to prevent Lone-Tar from backing up some file systems or directories,
such as a mounted CD-ROM. If you have a CD-ROM mounted under /cdrom, for
example, you could use this option to tell Lone-Tar to ignore that directory (after
all, there's little point in backing up a CD-ROM). You might also want to avoid backing
up mounted network drives, if you have any.
FIGURE
67.4. When creating a Master backup, Lone-Tar
lets you exclude directories that are not to be backed up.
You are then prompted to install a tape (or other backup medium, depending on
the backup device you specified during installation), and the backup process is started.
You see a few lines telling you that Lone-Tar is waiting to check the tape (in this
case). After that, Lone-Tar checks the tape (or other medium) to make sure that it
is ready.
Lone-Tar likes to initialize each backup device itself and mark the tape or drive
with a file identifying the backup as a Lone-Tar product. You don't have to mark
such backups, but they do help Lone-Tar in the restoration process. An error message,
such as the one shown in Figure 67.5, shows that Lone-Tar has determined that either
no tape is in the tape drive or a brand- new tape has been loaded. Instructions are
provided for marking the tape with the Lone-Tar file, but you don't have to do this
to perform a backup. Simply pressing Enter starts the backup process. Figure 67.6
shows the backup process underway. Lone-Tar echoes the name of each file and its
details to you while it is backing up the system. This display lets you see that
Lone-Tar is working properly.
FIGURE
67.5. Lone-Tar issues warnings if it detects
no tape in the backup drive, or if the tape is new and unmarked by Lone-Tar.
FIGURE
67.6. During the backup process, Lone-Tar
shows you the filename and the file's details as it works.
If one backup medium is not enough for the Master backup, Lone-Tar prompts you
to change the medium. Lone-Tar waits until you press Enter before continuing. After
the Master backup is completed, Lone-Tar returns to the main menu.
Lone-Tar can use compression when making backups to fit more information on a
tape or removable medium. The choice of using compression is up to you, and you will
probably be asked whether you want to use it during the installation process. The
advantage of compression is simple: more data in less space. The disadvantages are
twofold: It takes slightly longer to make backups when using compression, and the
compressed backup can be read only by Lone-Tar. A noncompressed backup can be read
by tar or Lone-Tar, which is a great advantage if you are moving your backup media
to another machine.
The amount of time required to make a backup depends on various factors, especially
the size of the file system, the speed of your backup system, and the load on your
system. If you have a fast system and a high-capacity fast backup device, Lone-Tar
can back up your system much faster than tar itself would have. The speed is most
limited, however, by the backup devices themselves. A DAT SCSI drive, for example,
is much faster than a QIC cartridge tape drive driven off the floppy. You will get
used to the amount of time required for a Master backup after a couple of backup
cycles. If a long time is required, start scheduling the backups at night while you
sleep, or when you go away for a length of time. Take note that most Master backups
take at least an hour, and often many hours, depending on the backup drives.
-
NOTE: Be sure to label
the tape or other medium with the date and type of backup. Write clearly! You never
know when you'll have to figure out which tape was made when.
To make an Incremental backup, you follow the same process. Because most Incremental
backups are much smaller than a Master backup, they also back up much faster. You
really should get in the habit of making Incremental backups either every day you
use the Linux system or whenever you save something you really can't afford to lose.
It's better to spend 10 minutes making a backup than four hours re-creating that
chapter of your latest book!
A selective backup, started using the S option on the Lone-Tar menu,
lets you back up only specific areas of your system. You are asked which files or
directories to include or exclude, and then the backup proceeds normally.
The Verify option provided by Lone-Tar is a security precaution that you should
use every time you make a backup. The Verify option scans the backup and compares
it to the original files. This action ensures that any backup errors are caught before
they become serious. It is a good habit to verify each backup after it has been made.
This is especially true when you have made new Master backups.
Remember that some files on your system might change between the backup time and
the verification time, depending on whether the system was used between the two times.
Some automated procedures, such as mail, logging, news, and automated background
tasks, alter files while a backup or verification is proceeding. Lone-Tar finds the
files different and reports errors to you. You should carefully read the reports
from the verification process so that you know which errors are important and which
are due to these system changes.
When you have to restore a file, a directory, or an entire file system, find the
proper backups. If you have been using the Master and Incremental routine, you need
the last Master and all the Incrementals since that Master was made. Alternatively,
if you are just looking for a few files you accidentally deleted, you might know
which tape or drive they are on and can use just that medium.
To start a restore process, select the R option from the Lone-Tar main
menu. This brings up the Restore menu, shown in Figure 67.7. Most of the options
on the Restore menu are self-explanatory. For example, to restore an entire tape,
you would use the option Restore entire tape to hard disk.
FIGURE
67.7. The Lone-Tar Restore menu.
Some of the other options on the Restore menu allow you to selectively restore
directories or files, based on exact names or wildcards. You can also build a list
of files or directories and have them all restored at the same time. Alternatively,
you can decide which files or directories are not to be restored, create an exclusion
list of them, and then restore everything else.
After you have decided which files or directories to restore, Lone-Tar asks you
to insert the tape and then starts the restoration process. As with a backup, Lone-Tar
echoes everything it does to the screen so that you can see what it is doing.
-
NOTE: When performing
a restore of a few files or directories, Lone-Tar has to search through the tape
or medium to find those files. This can be a slow process, depending on the speed
of the backup device, so don't worry if you don't see anything happening for a few
minutes. You should see the status lights on your backup device blinking to show
that the device is being used by Lone-Tar.
If more than one tape or other device is involved in the backup, Lone-Tar prompts
you to insert the next volume. It keeps doing so until the restore process is complete.
If you are restoring from a combination of Masters and Incrementals, you must
repeat the restore process for each tape. For example, if you accidentally erased
an entire directory, you could use the last Master backup to get the main files,
and then go through all the Incrementals made since the Master was created to obtain
any changes. You have to perform the updates manually using the Restore menu.
After the restoration is completed, Lone-Tar returns to the main menu. You should
verify that the backup was to the proper location and that everything looks correct.
Tape-Tell is a special feature of Lone-Tar that tells you a little about when
the tape was used. This information hinges on the Lone-Tar file that can be put at
the beginning of the medium. We discussed this file earlier, in the section "Backing
Up with Lone-Tar."
The Lone-Tar Utilities menu, shown in Figure 67.8, holds several useful commands
and functions. Most of these options are self-explanatory, and a few are very handy
for users. It is helpful to check the backup date of the last Master backup occasionally
as a reminder of when you should start thinking about a new Master backup.
The automated use of Lone-Tar through cron is a neat feature that lets your system
make backups without your being there. As you know from earlier chapters in this
book, cron lets you schedule commands to be run at particular times or intervals,
so you can easily set Lone-Tar to be run by cron to create Incremental backups every
night, twice a week, or whenever you want. You don't need to know details about cron
to schedule backups--Lone-Tar takes care of that for you.
The Utilities menu also lets you change the backup device type and details, so
if you have more than one backup system on your Linux system, you can change between
them. This capability is useful if you want to make Master backups to a high-capacity
device but Incrementals to a different device.
FIGURE
67.8. The Lone-Tar Utilities menu.
The Environment menu, shown in Figure 67.9, lists all the settings Lone-Tar works
with. Many of these were set when you installed Lone-Tar, but you can modify them
as needed to customize your installation.
FIGURE
67.9. The Lone-Tar Environment menu lets
you alter the behavior of the backup tool.
Lone-Tar has many features that weren't mentioned in this chapter, but you can
read the online documentation to find out more about the system. Using Lone-Tar for
your backup and restore operations is fast and easy, and you'll find yourself performing
them a lot more when you don't have to fumble with awkward syntax or worry about
mistyping a command. You should try out the Lone-Tar demo provided on the CD-ROM.
You'll find it very easy to work with.
Contact
reference@developer.com with questions or comments.
Copyright 1998
EarthWeb Inc., All rights reserved.
PLEASE READ THE ACCEPTABLE USAGE STATEMENT.
Copyright 1998 Macmillan Computer Publishing. All rights reserved.