Operating System - HP-UX
1832510 Members
4711 Online
110043 Solutions
New Discussion

Check wether tape is writable?

 
Danny Engelbarts
Frequent Advisor

Check wether tape is writable?

Hi there,

Does anyone know if it is possible to check if a tape is writable without writing to it?

Greetz, Danny
4 REPLIES 4
Rick Garland
Honored Contributor

Re: Check wether tape is writable?

Check the 'write-protect' tabs.
Tom Danzig
Honored Contributor

Re: Check wether tape is writable?

If your're running 11.x, use mt status.

If the tape is writable, you'll get:

Drive: HP C1537A
Format: DDS-1 format
Status: [41111300] BOT online compression immediate-report-mode
File: 0
Block: 0

If it's write protected, you'll get:

Drive: HP C1537A
Format: DDS-1 format
Status: [45111300] BOT write-protected online compression immediate-report-mode
File: 0
Block: 0

Notice the words "write-protected" in the output.
John Palmer
Honored Contributor

Re: Check wether tape is writable?

Hi,

Not that I know of, 'mt status' doesn't seem to give any indication.

However if you position to end of tape (by mt fsf until it fails or mt eod for DDS drives) then you can reposition to the final tape mark (mt bsf 1) and then attempt to rewrite it (mt eof 1). The latter will fail if the tape is write proteced and if it works you've not changed any of the tape's contents.

The only problem with the above technique is the time that it can take to get to end of tape.

Regards,
John
Patrick Wallek
Honored Contributor

Re: Check wether tape is writable?

That status option on mt is supported in 11.0. I generally use the syntax of:

mt -f /dev/rmt/#mn status

I just used the command on my internal DDS drive and it works like a charm.