Setting tape write protect?

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting tape write protect?

ap2010
Hi Mark,

as you know an LTO tape (amongst other types) has a write protect switch. Have you in anyway incorporated this?
I can imagine that the simplest way of doing this is having the tapefile set to readonly for mhvtl, so when a drive wants to open the tapefile it will notice that is is readonly (aka write protected).

Cheers,

Albert
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator


On May 5, 2011, at 5:09, "ap2010 [via MHVTL - Linux Virtual Tape Library - Community Forums]"<[hidden email]> wrote:

Hi Mark,

as you know an LTO tape (amongst other types) has a write protect switch. Have you in anyway incorporated this?
I can imagine that the simplest way of doing this is having the tapefile set to readonly for mhvtl, so when a drive wants to open the tapefile it will notice that is is readonly (aka write protected).

Cheers,

Albert

At the moment this idea is not supported.

But is one that should be.

I think the vtlcmd needs to be 'expanded' to be able to set a 'read only' flag within the virtual media.

Sent from my iPad

To start a new topic under MHVTL - Linux Virtual Tape Library - Community Forums, email [hidden email]
To unsubscribe from MHVTL - Linux Virtual Tape Library - Community Forums, click here.
Regards from Australia
Mark Harvey
nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

nia
Administrator
This post was updated on .
Will current LTO options do ? if you set only this rule for your LTO type : READ_ONLY: LTOx
nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

nia
Administrator
Sorry, I miss understood ... You meant tape and not tape drive ..
nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

nia
Administrator
Maybe library_contents.x flag for that volume would be logical also.
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

ap2010
In reply to this post by Mark Harvey
On 05/04/2011 09:24 PM, Mark Harvey [via MHVTL - Linux Virtual Tape
Library - Community Forums] wrote:

>
>
> At the moment this idea is not supported.
>
> But is one that should be.
>
> I think the vtlcmd needs to be 'expanded' to be able to set a 'read
> only' flag within the virtual media.
>
> Sent from my iPad
Hi Mark,

I don't think vtlcmd would be the proper tool to do this, as it is only
for controlling the library and tape devices at the moment.

Since the write-protect switch on an LTO tape is purely mechanical I
would be surprised if there is room in the MAM metadata for a write
protect switch. As said before the simplest way is just to make the data
file of a tape read-only and have vtltape deal with that as write
protected. The metadata file should stay readwrite in order to update
the load cycles of the tape.

Just my two cents.

Kind regards,

Albert
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator
The MAM struct is padded to 512bytes, so there will be room for one bit to signal Write protect.

The idea of chmod of data file has merit too.

i'll think about which one will be easier to implement :)

cheers
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

jonatan
Does anyone have an update on this feature?

It's been great using this software, I've been running it very smoothly with NetWorker 8 for some time now. Now I'm looking for a way to write-protect a tape for running some tests.

Note that write-protected (in the NetWorker sense at least) is not the same as read-only -- read-only just means that no NEW data can be written, and that in some time in the future, when all save sets on the tape have been marked as recyclable, the volume (read: tape) will be set recyclable. Then, when Networker feels like it, it will recycle the tape (that is, write new data to it). Whereas write-protected is, as pointed out, indeed a physical switch on the tape.
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator
LTO 4, 5 & 6 have an append only mode which can be set/cleared via vtlcmd. It may achieve your goals in the short term. 

Sent from my iPhone

On 06/12/2012, at 0:07, "jonatanblue [via MHVTL - Linux Virtual Tape Library - Community Forums]" <[hidden email]> wrote:

Does anyone have an update on this feature?

It's been great using this software, I've been running it very smoothly with NetWorker 8 for some time now. Now I'm looking for a way to write-protect a tape for running some tests.

Note that write-protected (in the NetWorker sense at least) is not the same as read-only -- read-only just means that no NEW data can be written, and that in some time in the future, when all save sets on the tape have been marked as recyclable, the volume (read: tape) will be set recyclable. Then, when Networker feels like it, it will recycle the tape (that is, write new data to it). Whereas write-protected is, as pointed out, indeed a physical switch on the tape.


To start a new topic under MHVTL - Linux Virtual Tape Library - Community Forums, email [hidden email]
To unsubscribe from MHVTL - Linux Virtual Tape Library - Community Forums, click here.
NAML
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

jonatan
Thanks! That was a quick reply :) I will try it out
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

jonatan
In reply to this post by Mark Harvey
It didn't work for this purpose, since it doesn't prevent you from writing data to the tape.

Thanks anyway, and thanks for making this great piece of software. Looking forward to a write-protect function in MHVTL!
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator
Now there is a 'edit_tape' utility, I had an easy method to modify virtual media to set/clear a write-protect flag.

Patch just committed to github..
commit f862159dc522082e7d5432b85f01d5a759f2c5c1
Author: Mark Harvey <markh794@gmail.com>
Date:   Fri Feb 8 18:51:03 2013 +1100

    Add ability to set media as 'read-only'
   
    Enhance new 'edit_tape' utility to set/clear the media write-protect flag
Please check it out and let me know your thoughts.

Usage: edit_tape -l lib -m PCL [-s size] [-t type] [-d density] [-w on|off]
       Where 'size' is in Megabytes
             'lib' is Library number
             'type' is data | clean | WORM
             'PCL' is Physical Cartridge Label (barcode)
             '-w on|off' enable/disable write protect flag
             'density' can be on of the following:
<cut>
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

jonatan
Looks good Mark! Glad to see this update.

# mt -f /dev/st0 status
SCSI 2 tape drive:
File number=-1, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x46 (no translation).
Soft error count since last status=0
General status bits on (5010000):
 WR_PROT ONLINE IM_REP_EN

tar complains as it should:
# tar -czf /dev/st0 /home
tar: Removing leading `/' from member names
tar: /dev/st0: Cannot open: Read-only file system
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors

Will try with Networker
nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

nia
Administrator
I did some testing with "mt" also, but seems that tape drive itself continue to think it is write-protected after tape is dismounted or even switched back to read-write ..

# mt -f /dev/st0 status
SCSI 2 tape drive:
File number=-1, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0
General status bits on (4050000):
 WR_PROT DR_OPEN IM_REP_EN

Only way to clear this is to restart MHVTL daemons ...

-nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator
Thanks for the report.. I'll check it out shortly.

The write-protect should be set/reset on media load..

Sent from my iPad

On Feb 12, 2013, at 1:29, "nia [via MHVTL - Linux Virtual Tape Library - Community Forums]" <[hidden email]> wrote:

I did some testing with "mt" also, but seems that tape drive itself continue to think it is write-protected after tape is dismounted or even switched back to read-write ..

# mt -f /dev/st0 status
SCSI 2 tape drive:
File number=-1, block number=-1, partition=0.
Tape block size 0 bytes. Density code 0x0 (default).
Soft error count since last status=0
General status bits on (4050000):
 WR_PROT DR_OPEN IM_REP_EN

Only way to clear this is to restart MHVTL daemons ...

-nia


To start a new topic under MHVTL - Linux Virtual Tape Library - Community Forums, email [hidden email]
To unsubscribe from MHVTL - Linux Virtual Tape Library - Community Forums, click here.
NAML
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator
Hi Nia,

Thanks for the bug report..

Well, there is no way I tested this feature very well..

I'll commit a fix to github within the next hr or so which will fix this bug.

The current code incorrectly resets the drive capabilities to loading the media-type as READ-ONLY instead of just the media capabilities.
i.e. If the drive is an LTO4 and you set one LTO3 media as 'write protect', the drive would (incorrectly) continue to load all LTO3 media as 'READ-ONLY' until the daemon was re-started.

Cheers
Regards from Australia
Mark Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

Mark Harvey
Administrator
Now pushed to github..
commit 7500136428c1df3c43aa70595fcfa039f97a4423
Author: Mark Harvey <markh794@gmail.com>
Date:   Tue Feb 12 07:28:13 2013 +1100

    Fix loading media with write-protect set.

    Fix faulty logic where loading of WRITE-PROTECTED media would update
    the drive capabilities to load all media of the same type to READ-ONLY
Regards from Australia
Mark Harvey
nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

nia
Administrator
Mark Harvey wrote
Now pushed to github..
commit 7500136428c1df3c43aa70595fcfa039f97a4423
Author: Mark Harvey <markh794@gmail.com>
Date:   Tue Feb 12 07:28:13 2013 +1100

    Fix loading media with write-protect set.

    Fix faulty logic where loading of WRITE-PROTECTED media would update
    the drive capabilities to load all media of the same type to READ-ONLY
It works as expected now.

Thanks Mark !!!

-nia
Reply | Threaded
Open this post in threaded view
|

Re: Setting tape write protect?

jonatan
Thanks for testing nia, and thanks for fixing it so quickly Mark.

Tested with Networker 8 today, it runs smoothly. First label the tape in Networker, then use edit_tape to enable write protection:
$ edit_tape -l 10 -m E01003L4 -w on

Then try and label the tape again in Networker:


Good stuff!