Robert Albano wrote:
> I want to create an archive on disk then write a copy of it to tape. Can
> I do the following?
> tar -cf backup1.tar /dir1 /dir2 /dir3
> cp backup1.tar /dev/st0
Yes. The tape will not have the blocksize tar expects, so to read the
tape later, you'll have to use the "-B" flag.
tar tvfB /dev/st0
or
tar xfB /dev/st0
Also, don't forget to compress the data with the "-z" flag.
tar cfz backup1.tar.gz /dir1 /dir2 /dir3
tar tfzB /dev/st0
> If I do repeated cp commands each with a different file
> cp backup1.tar /dev/st0
> cp backup2.tar /dev/st0
> cp backup3.tar /dev/st0
> and then do
> cp backup1.tar /dev/st0
> what happens? Does it erase the original file?
The tape driver rewinds the tape when it's closed. To prevent that,
use the non-rewinding device, /dev/nst0. See the st(4) man page for
more details.
> There appears to be no tape manipulation utility such as mt. What is
> good one to install? Do I really need one?
You should have mt. I have mt. Maybe it's an optional RPM in RedHat,
since most systems don't have tape drives.
> Is it a good idea to rewind the tape before copying to it?
> tar -cf backup1.tar /dir1 /dir2 /dir3
> mt -f /dev/st0 rewind
> cp --force backup1.tar /dev/st0
Yes.
> If cp does not work to a tape drive then should I use:
> #Create the archive write to disk
> tar -cf backup1.tar /dir1 /dir2 /dir3
> #Create the archive(again) and write to tape
> tar -c backup1.tar /dir1 /dir2 /dir3
That allows race conditions -- /dir1 may have changed between the
two tar operations, and then the tape doesn't match the on-disk
backup. Consider using tee (but only if cp doesn't work).
tar cfz - /dir1 /dir2 /dir3 | tee /dev/st0 > backup1.tar.gz
You do *NOT* want the "--force" option to cp above.
> Or would the following be better
> #Create the archive and write to disk
> tar -cf backup1.tar /dir1 /dir2 /dir3
> #Write the single archive file to tape via tar
> tar -c backup1.tar backup1.tar
A tar file of a tar file? Yuck.
> Eventually this will be in a script invoked by cron.
Have you seen the backup-via-rsync system developed by Mike Rubel? I
am looking forward to implementing this at our house -- the disk drive
arrived yesterday.
http://www.mikerubel.org/computers/rsync_snapshots/
Tape-based is good too, and it's a lot cheaper to send a tape off site
every week.
--
Bob Miller K<bob>
kbobsoft software consulting
http://kbobsoft.com [EMAIL PROTECTED]
_______________________________________________
Eug-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug