[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: trying to verify contents of my tar archive



on Sat, Nov 10, 2001 at 11:14:36AM -0800, Kurt Lieber (debian@kirpatrick.com) wrote:
> I've been using Karsten Self's sample backup script available in the Linux 
> Backup mini-FAQ at:
> 
> http://kmself.home.netcom.com/Linux/FAQs/backups.html
> 
> This script basically uses tar to archive a list of directories to tape and 
> then verifies the backup as well.  When I run the script, the output is the 
> following:
> 
> z8:~/backup# ./full.script
> tar: Removing leading `/' from member names
> [snip 8 more lines of this]
> /etc: verified
> /root: verified
> /boot: verified
> /home: verified
> /usr/local: verified
> /var/backups: verified
> /var/lib: verified
> /var/log: verified
> /var/www: verified
> 
> Which leads me to believe all the data has been backed up and is good to go.  
> However, if I do "tar tvf /dev/st0" to list the contents of the tape, all I 
> get is the following:
> 
> z8:~/backup# tar -tvf /dev/st0
> drwxr-xr-x root/root         0 2001-10-18 19:59:23 var/www/
> -rw-r--r-- root/root      4100 2001-03-22 17:39:29 var/www/index.html
> -rw-r--r-- root/root      1195 2001-10-18 19:59:23 var/www/search.html
> 
> I suspect this is more user error than anything, but I'm not sure what I'm 
> doing wrong.  I've tried rewinding the tape as well as doing a "mt -f 
> /dev/st0 asf" 1 to position the tape at the beginning, but I still get the 
> same output when I tar tvf.  Any help is appreciated.

YOU ARE USING A REWINDING TAPE DEVICE.  YOU ARE CREATING ONLY ONE TAR
ARCHIVE, OVERWRITING THE PRIOR ARCHIVE EACH TIME YOU CREATE A NEW ONE.
YOU ARE ***NOT*** ARCHIVING YOUR SYSTEM AS YOU EXPECTED.

Replace /dev/st0 with /dev/nst0.

   $ man st

...for more info, search "FILES".



The scripts I use save multiple tar archives to tape.  One necessary
element is to use a nonrewinding tape device.  /dev/st0 *REWINDS THE
TAPE AFTER EACH FILE OPERATION*.  The verification routines in my
script, if you look at them, run as:

    for path in $backupdirs
    do
	eval echo "Verifying $path...." $WALLMSG
	tar tf /dev/nst0 1>/dev/null && \
	    eval echo "$path: verified" $WALMSG || \
	    eval echo "$path: errors in verify" $WALMSG

...all this does is verify that the format of the tarfile is intact.  It
doesn't validate the data against disk.  What you're doing with your
rewinding device is:

   for list of archive directories:
       create archive
       rewind to start of tape

   rewind to start of tape

   for list of archive directories:
       verify that tarfile *is* a tarfile
       rewind to start of tape

You're verifying the same tarfile ten times.  Unfortunately, it's the
only tarfile on the tape.  Use /dev/nst0 instead.



To verify the archives on your tape, using a NONREWINDING DEVICE, you'd
do:

    mt rewind
    tar tf /dev/nst0
    mt fsf 1
    tar tf /dev/nst0
    ...

...until you reached the last file.  I'd discarded the output in my
verify above as it tends to make the job log rather verbose.  I may need
to fix that somehow.

Peace.

-- 
Karsten M. Self <kmself@ix.netcom.com>       http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?             Home of the brave
  http://gestalt-system.sourceforge.net/                   Land of the free
   Free Dmitry! Boycott Adobe! Repeal the DMCA! http://www.freesklyarov.org
Geek for Hire                     http://kmself.home.netcom.com/resume.html

Attachment: pgpCeoINzv3X2.pgp
Description: PGP signature


Reply to: