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

Julian Clark julian.clark at student.curtin.edu.au
Tue Oct 19 16:42:01 WST 2004


Hi Ryan
Umm, I'm no expert in this, but perhaps the dd command may be of some 
use to you. If I'm completely wrong, hopefully someone will set me straight.

Anyway.. something like this could do the trick.
dd if=/dev/zero of=/dev/your_tape_drive 
seek=num_blocks_to_start_of_long_file bs=some_block_size

As always, man dd will give you a better explanation than I can.

Hope this helps,

Julian

Ryan wrote:
> 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
> 
> _______________________________________________
> PLUG discussion list: plug at plug.linux.org.au
> http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
> 



More information about the plug mailing list