Blue Tape

Basic Primer on Tape Devices in /dev

Assuming tape drive is properly detected, several new devices will show up in /dev.

  • st0
    • tape device that will rewind the tape to the beginning after every operation
    • tape device in mode 0
  • nst0
    • tape device that will not rewind the tape to the beginning after every operation
  • st0l
    • tape device in mode 1
    • also available as nst0l
  • st0m
    • tape device in mode 2
    • also available as nst0m
  • st0a
    • tape device in mode 3
    • also available as nst0a

Note, in examples above, 0 may be replaced by another number if there is more than one tape drive in the system.

Modes

Based on Debian stinitDef:

  • st0 - compression off
  • st0l - compression on
  • st0m - explicitly disabled
  • st0a - explicitly disabled

Find the HBA card

If card is detected properly, it will show up in sys: (source)

# ls /sys/class/fc_host/
host6

Read RFID tag of tape (”LTO-CM”)

How to access LTO-CM? - Hewlett Packard Enterprise Community (hpe.com)

$ sg_rmsn -r /dev/sg2
AC2DE6NEHA

Erase a Tape

mt erase issues a SCSI erase command and takes as long as filling the tape with data. That’s about 3 hours for LTO5.

Quick Erase

A quick erase rewrite the Beginning of Data and End of Data markers but doesn’t expunge any data, so it’s much quicker but not secure.

mt erase 1 (source)

Write EOF

Another approach:

mt -f /dev/nst0 rewind
mt -f /dev/nst0 weof

LTFS

Format tape as LTFS

$ mkltfs --device /dev/sg2 --volume-name 000029L5 --tape-serial 000029

Remove LTFS From a Tape

$ mkltfs --wipe --device /dev/sg2 --volume-name 000029L5 --tape-serial 000029

Mount LTFS

# uid 1000 and gid 1000 is `mnielsen`
# Mounting in a home dir so it can be accessed easily by samba
$ ltfs /home/mnielsen/media/ltfs -o devname=/dev/sg2 uid=1000 gid=1000

Samba

🔥

Warning: this has a habit of crashing my machine if writing to tape

$ smbpasswd -a mnielsen
New SMB password:
Retype new SMB password:
Added user mnielsen.

Make “home” exports read/write by editing /etc/samba/smb.conf finding the [homes] section and changing read only = yes to read only = no.

STFS (Simple Tape File System)

https://github.com/pojntfx/stfs

Use SFTP and hardware compression

stfs serve ftp -d /dev/nst0l --metadata /home/mnielsen/stfs/metadata.sqlite

HP Library & Tape Tools (HPELTT)

HPE Library and Tape Tools | HPE Support

Debian-based

sudo alien --scripts hpeltt-6.5.0.10-4.x86_64.rpm

sudo dpkg -i hpeltt_6.5.0.10-5_amd64.deb

 $ sudo ls /opt/ltt/
 catalogs  firmware  hpe_ltt  logs  misc  scripts

sudo apt install libncurses5 libncurses-dev

sudo /opt/ltt/hpe_ltt

Red Hat-based

yum install mt-st

HPE LTT

yum install ncurses-base ncurses-c++-libs ncurses-libs ncurses-compat-libs ncurses-static ncurses-devel ncurses-term

ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5

ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5

./hpe_ltt

Main >
----------------------------------------------------------------------------------------------------------------------------------
Type the corresponding number to select a device, or enter a blank command for a command list
 
Libraries/Autoloaders:
 
Processors/Enclosures:
 
Drives:
   1 HP Ultrium 5-SCSI (Address: 60.0.0[6-/dev/sg2])
 
Other Devices:
   2 ATA KINGSTON SNS4151 (Address: 0.0.0[0-/dev/sg0])
   3 RAVPOWER DISK00 (Address: 70.0.0[7-/dev/sg3])

HP LTFS OpenStore

(give up, this won’t work on fedora 40. Error is “undefined symbol: UCNV_TO_U_CALLBACK_STOP_50”)

rpm -iv --nodeps HPE-SOS-3.5.0-62.x86_64.rpm

yum install libicu libicu-devel

ln -s /usr/lib64/libicudata.so.74 /usr/lib64/libicudata.so.50 ln -s /usr/lib64/libicui18n.so.74 /usr/lib64/libicui18n.so.50 ln -s /usr/lib64/libicuuc.so.74 /usr/lib64/libicuuc.so.50


LinearTapeFileSystem/ltfs

yum install icu fuse-devel libxml2-devel libuuid-devel net-snmp-devel automake libtool autoconf

git clone https://github.com/LinearTapeFileSystem/ltfs.git

cd ltfs

./autogen.sh

./configure

Apply patch: https://github.com/LinearTapeFileSystem/ltfs/issues/394#issuecomment-2082624342

make

sudo make install

Useful packages

  • lsscsi
  • scsi-tools
  • mtx - control SCSI media changer devices
    • apt install mtx
    • gives mtx, tapeinfo, loaderinfo, scsieject, scsitape
  • udevadm
  • Sg3_utils
    • Sg_read_attr -e

Rsync to ltfs

https://stackoverflow.com/questions/75128303/how-to-use-rsync-on-ltfs-linear-tape-file-system

0 items under this folder.