[Techtalk] backup - tar

Almut Behrens almut-behrens at gmx.net
Mon Aug 30 23:02:09 EST 2004


On Mon, Aug 30, 2004 at 12:04:20PM -0700, Maria McKinley wrote:
> Hi there,
> 
> I am using tar to backup, and I am really frustrated with it.  It keeps 
> going through a dozen or so files, and then quitting with no 
> explanation.  It does this no matter which files I try to backup.  The 
> command I use is:
> 
> nohup tar -czvf /dev/nst0 --atime-preserve /home > /tmp/backup &

theoretically, the problem could be that tar stops because it's trying
to output some error message (e.g. "cannot read...", or whatever -- for
whatever reason).  In the above command, you've only redirected stdout,
but error messages are being written to stderr.  And, as you've sent
the process in the background, you no longer have a terminal attached
that stderr could be sent to.  So, tar will wait and wait... (unless
you type 'fg').

In other words, you might need

  ... > /tmp/backup 2>&1 &

or one of the bash-specific shorter forms (also redirecting both stdout
and stderr):

  ... &> /tmp/backup &
  ... >& /tmp/backup &


Not sure whether that really is your problem, though (as you said it's
_quitting_ with no explanation).  But that's easy to check: if the
process just hangs, you should get some error output after re-attaching
the terminal again (fg).  Alternatively, you could use ps to check
whether the process is still there (it should be in state 'T' or 'TN',
in this case).

Having said this, I'd also rather recommend amanda, in general... :)

Or else, if you want to stick with tar, my personal recommendation:
do NOT compress the data.  I've too often had problems retrieving data
from tapes.  Sometimes, it was only a tiny bit of junk data somewhere
in the stream, but when your data is zipped, anything after that
point will be lost...  (You can use -L/--tape-length to change tapes,
if you need more than one).

Almut



More information about the Techtalk mailing list