svlug_tar_backup_hints

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



From: "David E. Fox" <dfox@tsoft.com>
Date: Sat, 13 Jan 2001 11:08:37 -0800
To: "Mike O'Neill" <mikeo@redhillstudios.com>
Subject: Re: [svlug] using a tapedrive
Cc: svlug@svlug.org

On Friday 12 January 2001 14:23, you wrote:
> Okay newbie question here.  I just attached for the first time a tape
> drive. Anyone know of a good online howto for using tar and the drive?  Man
> tar is nothing more than a command reference.

Using tar with tapes is just about like using tar with any other device. The 
one big thing to remember is the difference between your normal tape device 
(which rewinds) vs. the non-rewinding tape device. The first tape device is 
usually going to be /dev/st0, and the non-rewinding tape device, which is 
usually /dev/nst0.

If you're going to use 'mt' to position the tape (think of this like index 
marks on a VCR) you want to use the non-rewinding device, otherwise the tape 
will seek to the desired spot and rewind. This can be disastrous for your 
backup if you do something like:

# tar cvf /dev/st0 /home  #backup /home
# mt -f /dev/st0 fsf 1       # move to the end of the first archive
# tar cvs /dev/st0 /var     #backup var, which just wrote over the /home 
backup

Clearly, you wanted to use the non-rewinding device there.

Basically, you can write to the tape with tar just like another device:

# tar cvf /dev/st0 /      # this will back up everything

Some flags are useful, although optional. If you want to restore a functional 
system, you should use -p (--preserve-permissions) which extracts the 
original permission bits and ownership info from the other archive. 
Otherwise, it just uses the default umask values when creating 'new' files on 
your filesystem. 

I tend to use --block-size to give tar bigger blocks when writing to tape. 

> How can a tell how much space is left on a tape?

I don't think you can. But you can guess how much space a backup will take by 
using 'du'. But this is likely going to vary because of block sizes and inter 
record gaps and such.

> How do I extract an archive to a specific path other than the current dir?

tar normally doesn't include a leading '/' so what it writes is relative to 
wherever you happen to be. This is important to know when you do a restore, 
to be in the same place in the filesystem you were when you did the backup :).

===

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu