Well, I figured this out and I promised myself that when I did, I would
share the information so that no one else has to figure it out on their
own.

When using the -v -B options in afio, it tells you the byte offset of each
file in the archive.  Here is an example on how to use that information. 
This example also assumes you are using the default block size for afio
(5120).  I used an HP Surestore SCSI Tape Drive / DDS3 Tape for this
example too.


The following line comes from the -v -B output of afio:

10750485482 data/testfile.z -- (65%)

The number 10750485482 tells you that the file data/testfile.z is that
many bytes (10.7 GB) into the archive (In this example, it is the last
file in the archive too).  If you were to use the typical command:

afio -i -v -y "data/testfile*" /dev/st0

to restore that file, it would start at the beginning of the tape and
"search" for any afio header information matching that search criteria and
then restore it.  In this case, it would take just over 3 hours to restore
that one file (the same amount of time it would take to restore this
entire archive) because it has to read the entire tape to find files
matching that search criteria.

Now, if you have a SCSI-2 tape device which supports the 'mt -f /dev/st0
seek' command, you can dramaticly reduce the amount of time to do
selective file restores.  If you want to restore the entire tape, then you
are stuck with however long it takes (in this case, 3 hours).  You take
the byte offset of the file you want to restore (10750485482) and divide
it by your block size (5120) to get the block location of this file
(2099704.19).  Just drop everything after the decimal (Never round up or
you will end up going past the file location), so we end up with 2099704
which you use in the following commands:

Rewind the tape:

mt -f /dev/st0 rewind


Fast forward to the location you want to start the restore from (nst0
instead of st0 because we don't want it to rewind the tape after the
command finishes):

mt -f /dev/nst0 seek 2099704


Start the restore with afio (You need the -k option so afio doesn't fail
because it will start searching part way through the previous file in the
archive):

afio -i -v -k -y "data/testfile*" /dev/st0

You can replace /dev/st0 with /dev/nst0 in the last command if you don't
want it to rewind the tape after which is useful if you want to restore
another file after the current file location.

So, how long did it take to restore this exact same file using this better
method?  1 minute & 17 seconds, compared to 3 hours the other way.

Hopefully this helps someone else who may have been searching for the same
solution.

Cheers,

Trevor

_______________________________________________
clug-talk mailing list
[EMAIL PROTECTED]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca

Reply via email to