Skip to main content

Tape cheat sheet

One page, one command per task, for the HPE MSL 1/8 autoloader and its LTO-9 drive on pbs-01. The rotation, the pools and the slot plan are in the backup policy; this page is meant to be open in a terminal.

Everything runs as root on pbs-01. Every proxmox-tape action also exists in the PBS GUI under Tape Backup.

The model in four lines​

  • The loader is two SCSI devices: the changer (the robot) moves cartridges between the slots, the mailslot and the drive; the drive reads, writes, rewinds and ejects.
  • A cartridge is identified by its barcode sticker (ISC006L9), which is also its PBS label.
  • PBS keeps its own inventory of where each cartridge is and what it holds. A cartridge moved by any other means (front panel, loader web interface, pmtx, mtx) needs proxmox-tape inventory afterwards.
  • A cartridge written by PBS is readable by PBS only, with the encryption key. tar or LTFS on a pool cartridge destroys its content.

Set the drive once per shell, so that no command needs --drive:

export PROXMOX_TAPE_DRIVE=<drive>

Look​

TaskCommand
Slots, barcodes, what is in the driveproxmox-tape changer status
Drive state, loaded cartridge, positionproxmox-tape status
Label of the loaded cartridgeproxmox-tape read-label
All cartridges: pool, media set, status, expiryproxmox-tape media list
What is on the cartridgesproxmox-tape media content
Wear and remaining capacity (cartridge chip)proxmox-tape cartridge-memory
Read/write error countersproxmox-tape volume-statistics
Running and past tape tasksproxmox-backup-manager task list, then proxmox-backup-manager task log <UPID>

Move cartridges​

TaskCommand
Load by labelproxmox-tape load-media ISC006L9
Load from a slotproxmox-tape load-media-from-slot 3
Unload the drive to its slotproxmox-tape unload
Unload to a given slotproxmox-tape unload --target-slot 3
Slot to slotproxmox-tape changer transfer <changer> 3 5
Send a cartridge to the mailslotproxmox-tape export-media ISC006L9
Resynchronise PBS after a manual moveproxmox-tape inventory
Rewindproxmox-tape rewind (automatic on unload)
Eject without the robotproxmox-tape eject

A cartridge that came in through the mailslot is moved to a free slot with changer transfer, then proxmox-tape inventory.

New cartridges and cleaning​

TaskCommand
LTO-9 initialization, once per new cartridgethe loader's New Media Initialization Wizard (web interface), up to 2 h, before anything in PBS
Label every unlabelled cartridge in the loaderproxmox-tape barcode-label --pool <pool> (no --pool for a spare)
Label the loaded cartridge onlyproxmox-tape label --label-text ISC006L9 --pool <pool>
Erase a cartridgeload it, then proxmox-tape format --fast
Remove a cartridge from the PBS inventoryproxmox-tape media destroy ISC006L9
Clean the driveproxmox-tape clean (takes the CLN cartridge by itself)

Back up​

TaskCommand
List the jobsproxmox-tape backup-job list
Run a job nowproxmox-tape backup-job run <job>
One-off copy of a datastore to a poolproxmox-tape backup <datastore> <pool>
Pools and their retentionproxmox-tape pool list

The monthly cartridge: swap procedure.

Restore​

TaskCommand
Find the media setproxmox-tape media list (column media-set UUID)
Restore a whole media setproxmox-tape restore <media-set-uuid> <datastore>
Restore one snapshotproxmox-tape restore <media-set-uuid> <datastore> <store>:vm/107/<timestamp>
Cartridge unknown to this PBS (rebuilt host)load it, proxmox-tape inventory, then proxmox-tape catalog
Encryption keys known to this PBSproxmox-tape key list
Bring the key back on a rebuilt hostproxmox-tape key restore with the key file or the paper key, and its password

The key and its password are in the secretzone and on the paper break-glass.

First-time setup​

proxmox-tape changer scan
proxmox-tape changer create <changer> --path /dev/tape/by-id/scsi-<id>
proxmox-tape changer update <changer> --export-slots <mailslot number>
proxmox-tape drive scan
proxmox-tape drive create <drive> --path /dev/tape/by-id/scsi-<id>-sg \
--changer <changer> --changer-drivenum 0
proxmox-tape key create --hint "<hint>"
proxmox-tape pool create weekly --encrypt <key fingerprint>
proxmox-tape backup-job create <job> --store <datastore> --pool weekly \
--drive <drive> --schedule <calendar event>

--export-media-set on the monthly job moves the cartridge to the mailslot when the job ends.

Below PBS​

Diagnosis only, and never while a tape task runs. PBS ships its own low-level tools; the generic Linux ones (apt install mtx mt-st sg3-utils lsscsi) do the same.

TaskPBS toolGeneric Linux
Find the devicesproxmox-tape changer scan, proxmox-tape drive scanlsscsi -g — the changer is mediumx on /dev/sgN, the drive /dev/nst0
Robot statuspmtx statusmtx -f /dev/sgN status
Slot 3 to the drivepmtx load 3mtx -f /dev/sgN load 3 0
Drive back to slot 3pmtx unload --slot 3mtx -f /dev/sgN unload 3 0
Slot to slotpmtx transfer 3 5mtx -f /dev/sgN transfer 3 5
Drive statuspmt statusmt -f /dev/nst0 status
Rewindpmt rewindmt -f /dev/nst0 rewind
Rewind and ejectpmt ejectmt -f /dev/nst0 offline
Forward / back 2 filespmt fsf 2 / pmt bsf 2mt -f /dev/nst0 fsf 2 / bsf 2
Go to the end of the datapmt eodmt -f /dev/nst0 eom
Drive alertspmt tape-alert-flagstapeinfo -f /dev/sgN
Error counterspmt volume-statisticssg_logs -a /dev/sgN

/dev/st0 rewinds each time it is closed, /dev/nst0 does not: use nst0, otherwise the next write starts at the beginning of the tape.

A cartridge outside PBS​

On a spare cartridge that has no PBS label:

mt -f /dev/nst0 rewind
tar -b 512 -cvf /dev/nst0 /data/a # file 0
tar -b 512 -cvf /dev/nst0 /data/b # file 1, appended

mt -f /dev/nst0 rewind
mt -f /dev/nst0 fsf 1 # position on file 1
tar -b 512 -tvf /dev/nst0 # list it

-b 512 writes 256 KiB blocks; with the 10 KiB default of tar the drive does not reach its streaming speed.