tar does not help you here as you would not know where to seek to, but there is already a similar solution that is in use sice approx. 20 years in the
SAMFS/QFS project as a
In that solution, the starting block numbers are archived in a separate data base.
The problem here is that the tape seek does not work based on 512 byte blocks but rather in a tape record size base which is much larger. So the only way to make this work is to lookup the tape block number for a file, use
mt fsr xxx on the tape and then to start
ignore checksum errors mode.
This could work, but it has a problem since
tar does not exit after it has been able to successfully extract the named file and you need to wait until the current tape file ends.
If you played a bit with this method and believe it is worth, I could add a related option to
star to let it exit() after the file has been extracted.
star already has an option
-block-number that (together with
-v) prints the 512 byte based block numbers when in
-c mode. If you divide these numbers by the blocking factor (using integer arithmetic to round down the result), you get the
mt fsf parameter you need to seek forward.
The next version of
schilytools) will be ready some day in the next week. It will include a new option
-one-filé and another option
iskip=offset that allows to skip a specified amount of data from the first block in the read data. This will allow you to avoid the
Since today, schilytools-2020-06-09 is out and
star added the following options:
-one-file if this option is in use in extract mode and a file matches,
star exits after processing this file.
iseek=# is a byte offset to skip in the first read tape block before looking for an archive header.
mtseek=# This is a 512 byte based block offset that is based on the numbers printed with
star -cv -block-offset .... If the archive is a plain file,
star does a
lseek() to that offset before starting to read. If the archive is a magnetic tape,
star divides the block offset argument by the tape blocking factor and first issues an
ioctl() that forwards the tape to that position, then implicitely computes the remainder as
iseek offset in the first read block.
If you use
star -xp mtseek=# -one-file pat=* ... star forwards the tape, reads the file and exits after restoring the file.