[2537] in linux-scsi channel archive
Re: Is it a litle bug? (also on extension of errno.h)
daemon@ATHENA.MIT.EDU (Michael Weller)
Thu Sep 25 18:32:30 1997
Date: Thu, 25 Sep 1997 12:51:27 +0200 (MESZ)
From: Michael Weller <eowmob@exp-math.uni-essen.de>
To: paula@compos.com.br
Cc: linux-tape@vger.rutgers.edu, linux-scsi@vger.rutgers.edu
In-Reply-To: <3429140E.D364E228@compos.com.br>
On Wed, 24 Sep 1997, Joseilton Correia wrote:
> Hello Sir.
> I'm from Brazil and my english is too poor, so forgive me for my
> mistakes. I have a problem always when a try putting more than one
> backup on a tape. The problem is that the command mt -f /dev/nsft0
> eof don't work on my computer I'm the root and it give me the menssage
> Permission denied. What is happened?
My guess: The tape is write protected. 'mt eof' tries to write an
end of file mark on the tape, which is not possible then. As there is no
return code for a write protected media, linux returns permission denied
in this situation (at least the SCSI tape driver).
As there is some discussion about errno's for certain weird error
(operation unsupported on a specific model of CDROM): Tape driver
maintainers, why not finally add an EWPROT or something? My RS6K here
can happily report: 'mt erase' => Media is write protected.
[Oh, it is actually: #define EWRPROTECT 47 /* Write-protected media */]
Shouldn't be too difficult to have this added to [asm/linux]/errno.h, or?
> What I should do for putting more than one backup on a tape? Always
> that I try to make this the second backup erase the first one. Please
> help me.
There are two kinds of tape device names per physical device. Your name
looks kinda weird to me (but I do not know floppy tape standards). One
rewinds the tape at close (and writes 2 eof marks), the other only writes
a single EOF mark and does not reposition the tape.
I'd assume that /dev/nsft0 is the non rewinding tape (from the 'n') and
/dev/sft0 is the corresponding rewinding one. It is correct to use the non
rewinding tape with the 'mt' command, btw.
To do a multi backup tape, simply do several backup commands (say: tar) on
the same NON REWINDING tape. (like: tar -cvf/dev/nsft0 data1; tar
-cvf/dev/nsft0 data2; ...)
When finished, rewind manually using 'mt -f/dev/nsft0 rewind' (or use
/dev/sft0 for the last tar). For read do the same, but with tar -xvf.. or
tar -tvf for table of contents, or tar -dvf for bytewise verify (highly
recommended).
CAVEAT1: Tar is smart and knows when the tape is finished prior to reading
the EOF mark. Every second tar -xvf/dev/nsft0 will thus encounter a 0
length tape file. Either just ignore it, or use some option (-i ?) with
tar to instruct it to skip over the trailing EOF mark.
If you want to add another backup on an already written tape, you need to:
'mt -f/dev/nsft0 seod' (search end of data) first. If you use a rewinding
tape device, or mistype it as eof or whatever, your backup is easily lost
(!). Then just backup do the tape positioned this way. It is clear that
write protection has to be removed to allow for such an append operation.
CAVEAT2: From my own experience, doing several backups on a single tape,
ESP: appending to an already written tape is MUCH MUCH MUCH to dangerous
for any serious data. The risks of damaging your tape are far too high to
allow for this way of sparing tape costs. Adding several volumes on a
single tape in one go might be a tolerable risk, if a well tested script
does it automatically. Otherwise a single typo might overwrite some data
just written and you won't usually note it.
Michael.
(eowmob@exp-math.uni-essen.de or eowmob@pollux.exp-math.uni-essen.de
Please do not use my vm or de0hrz1a accounts anymore. In case of real
problems reaching me try mat42b@spi.power.uni-essen.de instead.)