Erase all tapes script?

danielparker

Active Member
Aug 29, 2010
11
0
41
Hi,

I have a Dell TL4000 Tape Library, and I thought I would have a play with PBS with it.. All of my tapes have been used by Bacula in the past, so I have to erase them prior to labeling them. I have not found a way to erase all tapes from the GUI.. so I was hoping someone has written a script that they could share to automate this process?

Thanks in advance.

Daniel
 
its dirty messy, but its what I use when I have to. Maybe others have a more elegant solution. Looking , I think it first revinds, writes weof, goes off line

Anyway I have to edit it each time for what I do since I have several libraries I have worked with.

the line for i in # # # # # #, would be the slots the tapes are in, so below tapes 1-6 are done in squence
if you where to do the whole libary, 1 2 3 so on 29 30

As a matter of fact I found this when working with bareos, a cousin, sister, brother of backula

Code:
#!/bin/sh

#LIBRARYB="scsi-1ADIC_A0C0316328_LLA"
LIBRARYB="scsi-ADICA0C0607908_LLA"
#DRIVE="scsi-3
#DRIVE="1"
#DRIVEPHY="scsi-F09C7CF004-nst"
DRIVE="0"
DRIVEPHY="scsi-F09C7CF000-nst"
for i in 1 2 3 4 5 6
  do
echo $i
#mtx -f /dev/tape/by-id/$LIBRARYB inquiry
mtx -f /dev/tape/by-id/$LIBRARYB status
#mtx -f /dev/tape/by-id/$LIBRARYB load $i /dev/tape/by-id/$DRIVE
mtx -f /dev/tape/by-id/$LIBRARYB load $i $DRIVE
echo "rewind "
mt -f /dev/tape/by-id/$DRIVEPHY rewind
echo "weof "
mt -f /dev/tape/by-id/$DRIVEPHY weof
echo "rewoffi "
mt -f /dev/tape/by-id/$DRIVEPHY rewoffl
mtx -f /dev/tape/by-id/$LIBRARYB unload $i $DRIVE
done
exit 0
 
Last edited:
just fyi, pbs comes with the 'pmt' and 'pmtx' tools which are basically rust rewrites of mt and mtx, but are pbs config aware, so you can use the configured drive/changer name
 
  • Like
Reactions: DocCyblade
just fyi, pbs comes with the 'pmt' and 'pmtx' tools which are basically rust rewrites of mt and mtx, but are pbs config aware, so you can use the configured drive/changer name
Awesome! I was not aware of that. I will be updating and testing the script with these. Thank you
 
just fyi, pbs comes with the 'pmt' and 'pmtx' tools which are basically rust rewrites of mt and mtx, but are pbs config aware, so you can use the configured drive/changer name

So I tried to use pmtx with the use of PROXMOX_TAPE_DRIVE and it works with status command, but when trying to use it with the load command, just does not want to work. Tried using the --device and --changer options and just keeps giving me the help prompts. Its strange it works with status command, but not the load. The sub commands transfer works fine. I ended up using the proxmox-tape command. Will be updating my post later today once fully tested
 
can you post the exact commands you entered? maybe it's a bug?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!