Command-Line Overview (Chapter 1)

  • Introduction and MINI-TUTORIAL
  • Backing up Data to Create an Archive
  • Comprehensive Archiving
  • Master and Incremental Backups
  • Non-Destructive Restore
  • Proper Use of the Catalog Option
  • COMMAND-LINE OPTION SUMMARY
  • ADVANCED FUNCTIONS
  • Talking with LONE-TAR Running in the Background
  • Special Environment Variables
  • SUFFIXES Environment Variable
  • COMP_EXCL Environment Variable
  • VIRTUAL_LIST Environment Variable

1.1 INTRODUCTION AND MINI-TUTORIAL

This is an introduction to the command-line use of LONE-TAR. It is designed for those who are new to the UNIX environment and who want to know a little bit more about what goes on behind the LONE-TAR Menu System. The menu system designs a command-line which actually performs the desired actions. This tutorial shows you how to use LONE-TAR directly from the command-line to perform some of the basic actions. This experience can then be applied to other options you may read about in the LONE-TAR MAN PAGES that aren't directly supported by the LONE-TAR Menu System. Additionally, understanding the command-line operation is helpful in answering certain questions that arise during the use of the menu system. DOS users new to UNIX can add to their knowledge and understanding by reading this section.

This LONE-TAR tutorial requires that users have completed the basic UNIX tutorial supplied with the operating system and are familiar with the terms covered in that book. Since XENIX and UNIX are so closely related, UNIX is used when discussing both. The DOS environment contains a few of the UNIX commands, but for all intents and purposes, is completely different. UNIX has a much greater number of files existing on a basic system than any DOS system, simply because it is designed to support multiple users. That is, it is designed to serve multiple terminals. Because of this, the user files which accumulate need to be backed up, as do the applications, databases and system files. LONE-TAR is our solution to the data backup and recovery problem. All of the functions of LONE-TAR are founded on basic UNIX expressions and syntax. To reduce LONE-TAR to its simplest form is to see that it can be used in one of three ways: to back up data (create an archive), to restore archived data, or to view the contents of an archive. With these three options come all the functions and modifiers available to enable you to very precisely tailor your commands to accomplish the task at hand.

The following examples show how these three basic jobs become user-defined for specific tasks and what the added LONE-TAR functions are designed to accomplish.

Special mention must be made of the principle of dot '.' This is a fundamental concept that deserves careful attention. Under UNIX, files can be copied with a leading './' which, when restoring from an archive, has a totally different effect upon their replacement than if they simply had a
'
/' because the leading dot means "local.'' But what does local really mean? It means that if you are residing in /tmp and the file ./etc/joker is extracted from some media to the filesystem, it will not be found in the /etc sub-directory. Instead a sub-directory called etc is made under /tmp (the local directory) and the joker file is put in /tmp/etc/joker.

If the file /etc/joker (without the leading `.') were to be restored, it would be put in the /etc directory as expected.

In the UNIX environment, filenames can have more than one dot within the filename. DOS filenames cannot.

1.1.1 Backing up Data to Create an Archive

Before the LONE-TAR functions can be understood in perspective, let's begin by creating a data archive on the media of your choice. LONE-TAR can be used to create an archive on any device that your operating system can access with the standard tar utility since LONE-TAR uses your system's device drivers to carry out all of its operations. LONE-TAR does not come with any special device drivers of its own, so choose the device with which you want to create an archive and load it with the proper media.

LONE-TAR needs a formatted media to work with, so if you are working with a floppy disk, make sure it is in the proper format before continuing. A preformatted DOS floppy works fine. Once you write data to it, however, it cannot be used by DOS again without reformatting.

All functions of LONE-TAR are given by calling LONE-TAR and telling it what to do. It is very responsive and does exactly what is asked, as long as it is specified correctly. The purpose of this tutorial is to learn how to communicate your needs to LONE-TAR clearly so that it can do exactly what is needed.

Let's create a simple archive of the /bin directory on the root filesystem. Many utilities reside in the /bin directory and this serves to illustrate a few main points.

lone-tar Cfbk /dev/Mediadriver block-size k-size /directory

This command-line calls the lone-tar program and indicates:

C create an archive on
f   the device which is named /dev/Mediadriver, with
b block size of block-size for the media, with
k volume size of k-size (e.g. for 1440 K use 1440)
 

So, to create an archive with a block size of 120 on a 600 Mb tape, you use the command:

cd /
lone-tar Cfbk /dev/rct0 120 600000 ./bin

 

As you can see, the C has no argument, while the f, b, and k functions do.

Now, the ./bin at the end of the command-line tells LONE-TAR which directory you wish to archive. This means go from the current directory to bin and copy all the files and directories under bin to the tape. This puts the files on the archive in '. /'(dot slash) format so that they can be restored locally later.

This example clearly shows that functions can be listed one after another and their modifying arguments listed respectively after the functions. This is important because incorrect arguments given for a function cause fundamental problems.

The following is a partial list of all functions that absolutely require arguments to follow them: f, b, k, s, L, E, G, d, and F. See the LONE-TAR manual for a description of these functions.

Any time you wish to employ these LONE-TAR functions, you should be sure that the arguments are following in their respective places in the same order as the function list.

Once the archive is created it can be used to try out some of the other LONE-TAR functions. Let's say we made a tape archive of the /bin directory. The command to list the files on the archive is:

lone-tar tvf /dev/rct0

or if the LONE-TAR Device Library has archive 8=/dev/rct0, simply type:

lone-tar tv8

and see the tape fly with a list of its contents. The t is mnemonic for table-of-contents. If you are not sure what the LONE-TAR defaults are, look at the LONE-TAR Device Library. This is in the /etc/default directory and look at the tar file there. Each configuration line represents a specific backup device such as a floppy or tape and is symbolized by a number in the range of 0 to 99. Instead of referring to a complicated device name and all its accessory information such as block size and capacity, you can refer to it as a single number. This simplifies the use of LONE-TAR from the command-line.

All the device numbers are assigned to a driver in the /dev directory and they also have block size, volume size, and a Y or N in the "Tape?'' field. This information should be edited to reflect the devices on your system if it is not correct. Editing the device number can easily be done from the LONE-TAR Menu System. Otherwise, attempts to use these archive numbers from within the LONE-TAR command fails or causes problems.

Once the LONE-TAR Device Library is in order, try using it. To verify that the archive files are in good shape on the tape, simply make the lower-case t an upper-case T for a True List or verify, such as:

lone-tar Tv8

/etc/default/tar

1.1.2 Comprehensive Archiving

All of the LONE-TAR commands covered so far have shown you what is transpiring while LONE-TAR does its work, but suppose you are called away from the computer while LONE-TAR is listing the tape contents and you return to a message like:

lone-tar: 800 files listed,
ALL OKAY!!

and all you can see on the screen is the last 20 filenames. How can you be sure that the files you need to archive really made it to the tape? Simply make the v function an upper-case V and LONE-TAR puts its output in a file called LAST_Verify. This file is kept in the directory
/log/BACKUPS.DIR or if this directory was not created then catalogs are placed in the root directory.

Now, to take the data off the media into, for example, the /tmp directory we use the x function to extract it as follows:

cd /tmp
lone-tar xV9 ./bin

Next, we go to the /tmp directory and tell LONE-TAR to extract and make a catalog file with the V function using the device 9 in the library. Notice that we request ./bin to be restored. If we enter

lone-tar xV9 /bin

the tape seeks to the very end without restoring any files because we made the archive in
'./' format previously. LONE-TAR informs you what it is doing during the restoring process and because of the
V you have a record of it.

That's the most basic side of LONE-TAR's archive, list and restore.

1.1.3 Master and Incremental Backups

Most UNIX systems require mandatory monthly or weekly Master backups and daily Incremental backups simply because of the enormous number of database file changes and changes to user files. LONE-TAR has been designed with this in mind, and the M (Master) and I (Incremental) functions make this process smooth and easy.

The Master backup starts at the root directory and runs through the entire filesystem looking for everything that can be backed up, which includes mounted filesystems. Try this:

cd /
lone-tar MV9

The Master backup takes a while so you can <DEL> out, but at least you feel the power of what is being accomplished, namely, a total system backup of all mounted filesystems, directories, regular files, device files, named pipes... everything. You may wonder: Is this really necessary?

Yes, you need everything relevant to the system in case of an emergency. Do you need the mounted filesystems? That definitely needs to be pre-determined. Do you need the /tmp and /usr/tmp directories? Probably. Remember, if you exclude these directories from the backup, they won't be there as directories even if you restore. Do you need the mail directories and files? Most people like to keep old mail, don't they? But it is important to realize that any mounted filesystems or directories, as well as specific files, can be excluded from the archive.

Once these types of questions are considered, this is how we Exclude files or directories from our Master backup:

lone-tar MV9EEE "/tmp/*'' "/usr/tmp/*'' /usr/leslie/mbox .

In the above example, we add three upper-case E functions to the function list we give LONE-TAR. One E is needed for every file (or directory) we choose to exclude. In the above case, after a survey, only Leslie said don't backup her mail. The wild-cards are used so that the entry for /tmp itself is backed up. When you use wild-cards on the command-line, enclose them within double quotes. This way, a fresh restore still has the /tmp directory with nothing in it. Otherwise, no /tmp directory is created from a full restore. This causes problems for utilities expecting to write in /tmp.

What do we need the Incremental backup for if we get everything at once on just one tape with a Master backup?

The Incremental backup is fundamentally an archive of only those files that have been changed since the last Master backup was created. It saves time, energy, and tapes. It can make for faster restores of frequently changing files. When you need to restore data from a tape, if it's not on the incremental tape from today or yesterday, or two days ago...and so on, then it has not been changed since the last Master backup. To make an Incremental backup, simply substitute the I in place of M and you see LONE-TAR filter out all files that are unchanged since the last Master backup was created. If a Master backup has never been created, it will copy all files.

1.1.4 Non-Destructive Restore

This function deserves special mention and is designed for more advanced work, but should be understood by anyone using LONE-TAR. Suppose there is an old tape with files on it that need to be restored to your current system; these do not exist any longer. This tape also contains files that do currently reside on your system, but in much earlier versions and they are not supposed to be restored because you don't want those files to overwrite the current versions of files. What can you do to get the files that don't exist back while screening out the files that do exist? One way to do this would be to make a list of all the files manually and put the files to be restored in the select.restore file. However, there is a much easier way to accomplish this.

The Non-Destructive restore function N is true to its name. When it restores a tape, it checks the target filesystem (usually on the hard disk) to be sure the filename does not exist, and if it does, it skips that file on the archive and tries the next one. In this way you can be assured that nothing on your system is overwritten. However, any file which LONE-TAR has archived but is not currently on the system is restored nicely. A sample of this function is:

lone-tar NVfbk /dev/rct0 120 525000

In this example, we are setting LONE-TAR to do a Non-Destructive Restore from the tape with a block size of 120 and it must be a 525 Mb tape. Notice that the N option replaces the x option here. It is not placed on the command-line in addition to the x.

You must always use the same b block size, and k volume size. The LONE-TAR Menu System enforces this, but if you are using LONE-TAR from the command-line, be careful of this fact. What happens if an archive is created with a block size of 20 and the volume size is 150000 (150 Mb tape) and then someone tries to verify the archive with a different block size?

lone-tar TVfbk /dev/rct0 15 60000

Well, the block size doesn't match and it isn't even a multiple of 20 so LONE-TAR reports that there is a block size mismatch when it reaches the end. LONE-TAR complains about being shorted a number of blocks. This is a WARNING and won't affect the integrity of the restored data if the data is confined to a single volume. However, on a multi-volume backup, it does affect the ability to cross volumes.

Let's say the block size used was 100 (multiple of 20). As soon as 60 Megabytes are verified, LONE-TAR thinks the volume is about to end and asks for the second volume to be inserted. These are fundamental issues that need to be kept straight. Always use the same block size and volume size when writing, restoring or verifying archives. If you are using the LONE-TAR Menu System, this is done for you automatically by using the same device number from the LONE-TAR Device Library.

Please verify your archives after they are created. Your best assurance that the data was written correctly to the tape is to re-read it and compare it to the data on the hard drive. For example, if the tape sags while data is being recorded, that same sag is not likely to be present during the re-read of the tape. The sag causes the tracks to become somewhat misaligned. This type of problem is detected by a read-after-write verification. Other problems such as crinkles, magnetic fluxes, or power drops while recording data may not be detected during the recording stage but will be detected on a read-after-write verification. Although most tape drives have their own internal read-after-write verification, this is not as reliable as rewinding the tape and doing a full re-read of the data.

LONE-TAR has two types of verification.

Level 1 verification re-reads the tape and does a basic integrity check of each file header. This is called a True Verify and is invoked with the
T option.
Level 2 verification referred to as Bit-level-verification) is necessary for very high integrity work and is invoked with the
TT option. It actually compares the files on the tape to that on the hard drive. It reports any differences found and detects failing tape drives in the very earliest of stages.

1.1.5 Proper Use of the Catalog Option

LONE-TAR is really very thorough when it comes to keeping copious records of its activity on your system. Any time the upper-case V option is given to LONE-TAR, a catalog is created. The default directory where the catalog resides is /usr/lib/lone-tar/BACKUPS.DIR and if this directory has not been created LONE-TAR assumes you want the catalog in the current directory (the directory from which LONE-TAR was run). This directory is created for you when you use the LONE-TAR Menu System to set up your catalog purge scheduler. In addition, there are optional variables in the LONE-TAR scripts and ltmenu, which instruct LONE-TAR further with regard to cataloging. The variable TARDIR tells LONE-TAR which directory to be used for the archive catalogs. For example, if you type from the command-line:

TARDIR=/usr/tmp;
export TARDIR

From that point on, all LONE-TAR catalogs are placed in the /usr/tmp directory. You see this variable in the ltmenu and cron scripts for you to change according to your needs. Again, consistency is expected here, for if one script puts catalogs in /usr/tmp, for example, and another uses /usr/lib/lone-tar/BACKUPS.DIR, it can become a confusing mess for someone needing to find a specific catalog. This holds true for any variable changes that are system specific. Any script changes should be reflected in the other scripts as well. This makes life simpler for everyone.

Another related variable is named TARFILE. This tells LONE-TAR which file should be used to keep the catalog information. The default cataloging system produces catalog names according to the function being performed by LONE-TAR. A Master Backup on the thirty-first of January would have a catalog name: Master_Jan.31 and the LAST_Master file would be linked to it until another Master Backup is made. This holds true for the Restore and Verify functions as well. If a filename is specified for the TARFILE variable such as:

TARFILE=/tmp/tar.catalog;
export TARFILE

This tells LONE-TAR that every time the V option is used to place the record of LONE-TAR's activity into a file named lone-tar.catalog in the /tmp directory. This means that each time V is used, the old lone-tar.catalog file is overwritten with the new one. In this way only the last run of LONE-TAR is recorded.

Some people like the idea of only the last run of LONE-TAR being cataloged but want it broken into the specific categories of Backup, Restore, Verify, Listing, etc., so for this purpose we have added the value "NONE'' for TARFILE.

In this case, you should type:

TARFILE=NONE;
export TARFILE

When this is executed at the command-line, LONE-TAR is told that whenever it is called upon to create a catalog file, it is only required to save the last catalog of each type of LONE-TAR function. Otherwise, LONE-TAR keeps making catalogs, when asked, and saves them all, so that eventually, some housecleaning is needed. This housecleaning can be done automatically if you enable automatic catalog purging from the LONE-TAR Menu System. By setting TARFILE to ``NONE'' as described above, there is nothing to clean. For example, the last Master backup would be called LAST_Master, the last verify of an archive is saved as LAST_Verify, and so on. For your information, the actual creation date of the last master archive is saved in a special file (/etc/Master_backup) regardless of whether or not the upper-case V (catalog) option is used. This makes it possible for the Incremental backups to always be truly incremental in that they are all files created or changed since the last master archive was made.

1.2 COMMAND-LINE OPTION SUMMARY

The following tables summarize the command-line options by function. The items are listed alphabetically so you can use this for quick reference. Table 1 shows a summary of the common options used with listing files or verifying files on a tape. Table 2 shows a summary of the command-line options used in restoring files. Table 1 shows a summary of the common options used with listing files or verifying files on a tape. Table 2 shows a summary of the command-line options used in restoring files.

Table 3 address the common functions needed when doing a backup. All backups need to have one of the following options: c C M I P. Each of these can take one or more modifiers to specify the additional backup features desired. These are summarized in Table 4. Take a moment to become familiar with these so you will know the powerful capabilities of the product. You will probably refer to these tables often if using the product from the command-line. Keep in mind, that most of these functions are available through the LONE-TAR Menu System and you do not need to memorize these tables in order to use the product.

1.3 ADVANCED FUNCTIONS

With the new release of LONE-TAR version 3.2, a number of features have been added which better achieve the level of archive precision which you have requested. Even though their uses are covered in the LONE-TAR MAN PAGES chapter, some deserve special attention here for new LONE-TAR users.

1.3.1 Talking with LONE-TAR Running in the Background

In the past, if LONE-TAR were designed to run as a background process, users did not have the ability to interact with special action prompts such as:

PLEASE REMOVE VOLUME: 1
INSERT VOLUME: 2 AND TYPE "y" WHEN READY! __
 

because all messages were sent to standard error and these did not reach user terminals. The new release LONE-TAR 3.4 incorporates message passing to standard out as well as a unique feature of the named pipe file /dev/lone-tar_listen to facilitate communication between the user and the background LONE-TAR process.

Any user interactive messages can now be responded to by directing the response into this named pipe and LONE-TAR will commence its work. This eliminates endless waiting by LONE-TAR for unanswerable questions. Simply use the echo command to respond to the LONE-TAR messages issued from the background according to the following example:

PLEASE REMOVE VOLUME: 1
INSERT VOLUME: 2 AND TYPE "y" WHEN READY!__

from wherever you are on your system, you can simply type

echo "y" > /dev/lone-tar_listen

and LONE-TAR reads the answer and completes its appointed task. This example shows how any reply to LONE-TAR that you would normally type on the command-line can be echoed to LONE-TAR through the named pipe /dev/lone-tar_listen easily.

If you are using the LONE-TAR Menu System this is easily done by selecting the choice:

10) Unattended Backup - Notify LONE-TAR you have switched tape volumes

from the miscellaneous sub-menu. This does the same thing as the echo statement above.

1.3.2 Special Environment Variables

The other advanced options that deserve particular emphasis here are the LONE-TAR variables which can be set from within the menu or directly in the variable ascii file variables which resides in the /usr/lib/lone-tar directory.

Of particular significance in the backup and restore operations are the variables: SUFFIXES, COMP_EXCL, VIRTUAL_LIST, and INCREM_TYPE.

1.3.2.1 SUFFIXES Environment Variable

The SUFFIXES variable is for use with compressed backups only. When this variable is set to equal a filename suffix, any filename that ends in that suffix is automatically excluded from the archive. Up to fifteen suffixes can be defined for this variable. An example of filename suffix defining for the SUFFIXES variable follows:

SUFFIXES= ".zzz .lrc .cmp .toa''

By default, any file ending in ".Z .z .zoo .arc .zip .gz'' is already automatically excluded as LONE-TAR recognizes these common compressed files. Therefore, only files which are already specially compressed should be excluded with this variable. Wild-cards cannot be used here. Each entry must begin with a dot.

1.3.2.2 COMP_EXCL Environment Variable

The COMP_EXCL variable is similar to SUFFIXES but is more complete. The COMP_EXCL completely excludes entire directories or filenames that are known to be full of compressed data. If these files and directories are not specified in the exclusion options there is a strong possibility of ``Negative-Compression'' occurring which results in a larger file being produced on the archive. So in the same way, you must define a string of filenames and/or directories that contain only compressed data. For example:

COMP_EXCL="/usr/u/leslie/compdraw /usr/u/ashley/compgraph"

In the above example there are two directories defined as completely excluded because they are full of compressed images.

1.3.2.3 VIRTUAL_LIST Environment Variable

On a different note, there are certain types of files referred to as Virtual Files, which are specially designed for optimum data storage. Unfortunately, if your system uses these files they can be difficult to back up and restore. We have designed the new LONE-TAR version 3.2 to be fully compatible with Virtual Files and therefore we must define the VIRTUAL_LIST variable. Before working with Virtual Files on your system, please read the section entitled VIRTUAL FILE SUPPORT.

Once the names of the Virtual Files on your system have been identified, you need to create an ascii text file containing the names of these files, one file per line. When writing this file, be sure

to use the full path and filename of the virtual files. For example, if three Virtual Files are found as:

/usr/aps/acct/BIGDATA.vrt
/usr/pres/acct/MONEY93.vfl
/usr/comish/DEALS.V
 

You can create a file called Virtual.lst in the /usr/lib/lone-tar directory which contains only these three lines. This tells LONE-TAR which path and filename contain the Virtual Files that need its special consideration. You place the Virtual List file anywhere, but we suggest using the /usr/lib/lone-tar directory.

Once the file is created, simply define the variable:

VIRTUAL_LIST=''/usr/lib/lone-tar/Virtual.lst'' (or whatever was created)

 

User Rating: / 2
PoorBest