next up previous contents
Next: Data Representation Up: DIGITAL Unix Implementor's Guide Previous: The grep utility

Backup and File Compression

This session gives a brief and limited overview of Unix backup features. More complex backup operations depend on data nature and size and must be solved with well debugged and controlled procedures implemented taking into account specific needs.

As Unix does not support new versions of files, in Unix systems archive is a primary task for the implementors. Code libraries can be maintained by ar. Archives on tapes or, optionally on files, are created by tar:

$ tar cvf tarfile.tar filenames [directory_name]

cvf -> c = create a new tar archive
       v = verbose: produce list of files
       f = specify filename for tar file
tvf -> t = list tar archive file
xvf -> x = restore tar archive

Always use tar with caution. If the x option is used instead of c and the named tar file exists, the new files are replaced by the older ones in the existing archive. It is a good practice to place the tar files in a dedicated directory and to use the current date as a prefix or postfix of the tar file name, thus limiting overwrite risk and damage.

When creating a tar archive, use a relative directory to start tar to be able to restore files elsewhere. Compress tar archives to save disk space. Compress utilities replace the original files with the compressed ones, keeping the name of the uncompressed files suffixed by .Z.
Examples:

> tar cvf data.tar *.dat        # archive all .dat files on data.tar
> tar cvf proj.tar Proj         # archive Proj directory tree on proj.tar
> tar cvf doc.tar Text Eps      # archive Text & Eps dirs on doc.tar
> tar tvf proj.tar              # list contents of archive proj.tar
>
> ls -l 
-rwxr-xr-x   1 judy     users      32768 Jun 24 09:36 a.tar
-rw-r--r--   1 judy     users        632 Jun 10 15:59 totw.f
>
> compress a.tar                   # compress archive a.tar
> ls -l
-rwxr-xr-x   1 judy     users       7046 Jun 24 09:36 a.tar.Z
-rw-r--r--   1 judy     users        632 Jun 10 15:59 totw.f
>
> zcat a.tar.Z | tar tvf -         # list compressed tar archive
> zcat a.tar.Z | tar xvf -         # extract compressed tar archive

Note that Unix enables sending binary files as mail messages provided that the files are converted using uuendcode.

An example of the commands used to archive on tape experimental raw data is given below.

> make d_raw                                # create raw path
> cd d_raw                                  # move to rawpath
> tar cvf /dev/rmt0h  LVD*.??-???-??        # create tar tape on tape nnnn
> tar tvf /dev/rmt0h > /rawbup/LIST.nnnn    # create tar list of tape nnnn

Note that the tape no. nnnn is not part of the tar files and must be correctly handled by the complex procedures that manage the off-line processing of the experiment.


next up previous contents
Next: Data Representation Up: DIGITAL Unix Implementor's Guide Previous: The grep utility
Marisa Luvisetto
2001-02-05