Script to label scratch tapes

Sunhillow

ADSM.ORG Senior Member
Joined
Oct 27, 2003
Messages
408
Reaction score
16
Points
0
Location
Stuttgart, Germany
Hi all,

as we did not yet upgrade our TSM server to 5.5.2.1, I wrote a Perl script to label all virtual tapes with status = 'Scratch'.

As TSM Server won't complain when date tapes are being labeled, I fear this might be a bit dangerous. Do you think it might happen that I write a label to a tape used for data? The VTL then would "think" the last write position is at the beginning of the volume, so shrink it to its minimum size and discard the rest?
 
Sunhillow,

You won't be able to re-label a tape if there is still valid data on it. TSM simply will not let you do that. Even a tape that is scratch will not be relabeled (if it exists in the volume history) unless you use the "overwrite=yes" switch in the label command.

You'll see errors such as this in your activity log:

ANR8807W Could not write label NO5000 on the volume in drive VTL_DRIVE_1
(/dev/rmt/55st) of library QUANTUM_VTL_2 because volume is already labeled
NO5000.

If you use the overwrite=yes switch, you will be able to relabel the tapes - but again TSM will only let you do that for tapes that have no valid data.

Hope this helps...
 
Thank you cjhood,

I tried the script and it gave me more than 15 TB space (from 82).

What it does is:
- check for scratch tapes
- CHECKOUT libv $tsmlibr $tape rem=n checkl=n
- LABEL libv $tsmlibr search=y voll=$tape labels=b checkin=scr overwrite=y

If it is not possible to label a volume containing data, nothing bad can happen there :D
 
Excellent, looks like it's working properly.

Well I wouldn't say nothing could go bad ;) I have had instances where I wanted to re-write the label on an active tape (it had been destroyed somehow) but TSM won't do it, so the data is lost.

But in this case all should be good for you!
 
Back
Top