[plug] Erasing a file from the end of a tape

Ryan ryan at is.as.geeky.as
Tue Oct 19 16:20:11 WST 2004


Hi Plug,

I can't figure out what seems to be a simple request - 'erasing' the
last file from a tape.  By 'file' I'm talking about a properly written
stream of data without an EOF that hit the end of the tape before
completion.

I'm writing large files to tape one at a time using tar to later allow
myself to use 'mt asf' to jump directly to a particular file on tape and
extract it.  That all works fine.

When I write the data, I try to squeeze as many files on as possible and
sometime the final file is too large and will hit the end of the tape. 
Therefor I just want to go back to the start of that file (which I can
do) and then erase everything after it (which I don't know how to do).  

The intended result is that when I read the tape back to list its
contents (involving lots of runs of tar), I want it to hit what is
currently the EOF marker for the second last file and then on the next
listing request report end of data or i/o error - as would normally
occur if that EOF was the last thing ever written to tape.  So I just
want to nullify the final file from the tape.

I was thinking maybe of asfing to the final file, backing the tape over
1 EOF marker with bsfm (which leaves the tape positioned before the
EOF), write another EOF marker over the existing one to be left
positioned at what is intended to be the end of the tape, and then
magically write an end of data mark or nullify all further data with a
data stream of some sort, but I can't work out how.

One way is to write a known small file in place of the last file and
educate my listing software (my own scripts) that seeing such a file is
the end of the tape  - but I'd much rather do this using the tape than
some dodgy signalling mechanism.

Is there a way to do this that doesn't involve scissors and sticky tape?

Ryan




More information about the plug mailing list