ProxMox Backup Server Tape Label Nightmare

I just installed ProxMox Backup Server (4.1.1), and am setting up tape changers with it. Unfortunately, they offer no support for automatically overwriting foreign media (i.e. media that was written to by any other application). I am moving away from Veritas Netbackup and VMware over to ProxMox, so I have a number of tapes that have data on them I wish to overwrite.

Since they do not offer any way to automatically overwrite, it requires you to manually format and label the tapes. By writing to them. This is insane, and incredibly time consuming and completely unnecessary when it would be trivial to add a checkmark to let me overwrite foreign media automatically.

But, at least there is a command line tool that lets you automate some of the process by hand. This is a quick and dirty script that works with my 8 slot tape changers. It wouldn’t be hard to make it auto-detect the number of slots. But this works for me for now:

#!/bin/bash

# Put the names of the changer and drive as you named them in ProxMox

CHANGER=LTO-6-Changer
DRIVE=LTO6-01


# Go from slot 1 to slot 8; you could parse out the number of slots, or just give a list of specific slots here

for SLOT in {1..8}
{
	MEDIAID=$( proxmox-tape changer status "${CHANGER}" --output-format=json | jq --argjson slot "${SLOT}" '.[$slot]."label-text"' | tr -d '"' )

	proxmox-tape load-media-from-slot ${SLOT} --drive "${DRIVE}"
	proxmox-tape format --drive "${DRIVE}" --fast=true
	proxmox-tape label --label-text "${MEDIAID}" --drive "${DRIVE}"
	proxmox-tape unload --drive "${DRIVE}"
} 

Leave a Comment