tar -r on a diskfile/tar arg too long

karish at mindcrf.UUCP karish at mindcrf.UUCP
Sun Jun 10 02:00:02 AEST 1990


In article <1340 at ziggy.EDU> ssi at ziggy.cmd.usf.edu.UUCP (Ssi) writes:
>In article <1339 at ziggy.EDU> ssi at ziggy.EDU (Ssi) writes:
>$ Does anyone know any draw backs/problems with using the -r option of
>$ tar(1) on disk files, as in:
>$ 
>$ cat /dev/null > TARFILE
>$ tar -cvf TARFILE long_list       <<-- table of contents as first file
>$ for i in `cat long_list`
>$ do
>$ tar -rvf TARFILE $i             <<-- append each file to TARFILE
>$ done
>$ tar -cvf /dev/rmt0 TARFILE      <<-- put the whole thing to tape 
>$ rm TARFILE

Unless nested tar files are somehow advantageous, I'd use 'dd' to
put TARFILE to tape.  This lets you choose the biggest block size
your tape drive can handle, which often results in a substantial
increase in tape capacity.  The tradeoff is in portability; drives
vary in the block size they can handle.

>$ note:
>$ tar -cvf /dev/rmt0 `cat long_list` 
>$ Would give tar argument too long error.

If 'tar -r' turns out to be the best answer, use 'xargs' instead of
the shell loop.  It'll minimize the number of seeks and process
creations needed.

>Maybe I should mention that this is part of a bigger picture, to
>backup a network that requires more than one tape, and has to
>run on a `live' system.

In this context, the proposed scheme makes less sense than it did
before.  Where do you find disk space for the tremendous working file?
You can't back up the whole system unless half the server's disk
is kept free.

As previously noted, cpio works fine with an arbitrarily long
input list (on stdin, not on the command line).  If your system
doesn't have it, or you don't care for the user interface or
the error messages, try one of the public domain or freely-
distributable tar programs like pax, pdtar, or GNUtar.  I think
pax and GNUtar can read long input lists.  With the source,
it's not hard to make any of 'em do it.

The real trick is to handle multi-volume archives properly.  Some tape
drives can sense end of tape and report it in a timely fashion, and
others can't; ditto for the drivers that should listen for those
reports.  The usual remedy has been to tell the program how long your
tape is and what average data density you expect, and let the program
guess how much will fit on each volume.  You should adjust these
parameters (yes, lie to tar!) to take into account the block size
you're using and the characteristics of your tape drive: different
drives put different-length gaps between blocks.
-- 

	Chuck Karish		karish at mindcraft.com
	Mindcraft, Inc.		(415) 323-9000		



More information about the Comp.unix.wizards mailing list