With all of the excitement lately about various software firms planning Linux
ports of their products, it's easy to lose sight of the great power and
versatility of the unsung small utilities which are a part of every Linux
distribution. These tools, mostly GNU versions of small programs such as
awk, grep and sed, date back to the early pioneer days of
Unix and have been in wide use ever since. They typically have
specialized capabilities and become especially useful when they are chained
together and data is piped from one to another. Often a shell script serves
as the matrix in which they do their work.
Sometimes a piece of software native to another operating system is ported
to Linux as an independent unit without taking advantage of pre-existing tools
which might have reduced the size of the program and reduced memory usage.
It's always a pleasure to happen upon software written with an awareness of
the power of Linux and its native utilities. Bu is a backup program
and NoSQL is an ASCII-table relational database system; what they have
in common is their usage of simple but effective Linux tools to accomplish
their respective tasks.
Shell-script Backups With bu
Making a backup of the myriad files on a Linux system isn't necessary
for most stand-alone single-user machines. Backing up configuration and
personal files to floppies or other removable media is normally all that is
necessary, assuming that a recent Linux distribution CD and a CDROM drive are
available. The situation becomes more complex with multi-user servers or with
machines used in a business setting, where the sheer number of irreplaceable
files makes this simple method impractical and time-consuming; in these cases
the traditional method in the unix world has been to use cpio or
another archiving utility to copy files to a tape drive. Though the price of
hard disks has plummeted in recent years while their capacity has ballooned,
reliable tape drives capable of storing the vast amounts of data a modern
hard-disk can hold are still quite expensive, sometimes rivalling the cost of
the computer they protect from loss of data.
Vincent Stemen has developed a small backup utility called bu which
is shell-based and makes good use of standard Linux utilities such as
cp and sed. Rather than being intended for
backups to tape or other streaming device, bu is designed to mirror
files on another file-system, preferably located on a separate hard drive.
Bu is just a twelve kilobyte shell script along with a few
configuration files. It's remarkably capable; compare this list of features
with those of other backup utilities:
Checks timestamps and only copies new or changed files
Deals with symbolic links intelligently
Writes a log-file upon completion
Will ignore directories which are mounted filesystems
Easy specification of files and directories to include or exclude
Bu in its earlier versions used cpio extensively, but due to
a problem with new directory permissions cp is the main engine of the
utility now. Cp -a used by itself can be used to bulk-copy entire
filesystems to a new location, but the symbolic links would have to be dealt
with manually, which is time-consuming. Also missing would be the ability to
automatically include and exclude specific files and directories; bu
refers to two configuration files, /usr/local/backups/Exclude and
/usr/local/backups/Include, for this information.
This small and handy utility isn't intended to completely supplant
traditional tape-drive backup systems, but its author has been using bu
as the basis of a backup strategy involving several development machines and
several gigabytes of data. Bu can be obtained from this