Since the introduction of the LTO5 – LTFS gives us a very easy way to use tapes for archival without expensive / complex backup software. This mechanism suits me, as I’m using them directly in place of hard disk backup.
There is one slight problem with HP’s implementation of LTFS for windows – which is that there’s no way to perform critical operations i.e. loading, ejecting, mapping, unmapping from the command line. Everything has to be done from a GUI.
Yup, you heard me correctly. I’ve been searching for hours for solutions and have come up empty handed. This stuff is of course straight forward on Linux/macOS, because on these operating systems it’s actually quite hard to build things like this in a way that GUIs are required.
You would think that LTFS being open source, that it’d be easy to come up with some kind of script to perform these tasks, but this does not turn out to be the case.
LTFS for Windows is distributed with a bunch of binaries which despite the core implementation being open source – HP don’t distribute the source for Windows specific binaries. Why not? Because they don’t f–king have to.
This includes LTFSConfigurator.exe which does all of the critical management of drives/volumes.
Reverse engineering LTFSConfigurator.exe
Publicly available documentation as to how LTFS integrates with Windows is disappointingly vague – offering us no clues as to how to even develop a command line tool to perform these tasks.
In absence of that I spent several days disassembling and debugging LTFSConfigurator.exe to understand how it works, what it’s doing and how we can build a command line equivalent of it.
Frustratingly – looking at the source code for LTFS was no help, as it quickly became apparent this tool mostly interacts with Windows, not LTFS.
The result of this is I’ve built a command line tool which does most of what LTFSConfigurator.exe does. I won’t go into the details but unlike HP – I’ve released the source for this tool. You can view it on Github.
Usage: ltfscmd -o operation [options] List tape drives: ltfscmd -o listdrives List mappings: ltfscmd -o listmappings Map tape drive: ltfscmd -o map -d DRIVE: -t TAPEn [-n] [-l logdir] [-w workdir] Replace DRIVE: with your intended drive letter i.e. T: Replace TAPEn with the tape device name returned from the list operation i.e. TAPE0. Pass -n to show all files as 'online'. Not recommended. Pass -l and/or -w to override default log and working directories. Unmap tape drive: ltfscmd -o unmap -d DRIVE: Fix existing mappings: ltfscmd -o remap In some cases, particularly when drives are hot-plugged, the device index may change i.e. from TAPE0 to TAPE1 breaking an existing mapping. This operation will repair existing mappings. Start FUSE/LTFS service: ltfscmd -o start If the operating system was booted with the tape drive powered off or disconnected, filesystem services will not have started. Use this operation to start them. Stop FUSE/LTFS service: ltfscmd -o stop Physically load tape and mount filesystem: ltfscmd -o load -d DRIVE: Physically load tape without mounting filesystem: ltfscmd -o loadonly -d DRIVE: Use this if you intend to format the tape immediately. Mount filesystem: ltfscmd -o mount -d DRIVE: Note that 'mounting' is a vague concept under Windows. This operation is equivilent double clicking the drive icon in Windows explorer, which will cause LTFS to read the inserted tape and report size/usage/label information back to the operating system. Unmount filesystem and physically eject tape: ltfscmd -o eject -d DRIVE: Check if a tape is loaded and report tape type: ltfscmd -o checkmedia -d DRIVE:
- Don’t expect this tool to check whether or not your tape drive is actually compatible with LTFS. It’ll try and map any ol’ tape drive you point it at. In the even that drive isn’t compatible, you can expect LTFS to crash. The original HP utility has a bunch of checking to ensure the target drive is compatible with LTFS. My attempts to reverse engineer this didn’t go so well, so I gave up on it. We don’t actually need this bit anyway.
- Format/Unformat is unsupported. ‘mkltfs’/’unltfs’ can be used to to perform these operations from the Windows command line.
- Other obscure options such as Verbose logging, Index capture, Index updates & Index partition usage cannot be configured with this tool.
At present this tool is still under development. The source code can be viewed here on Github.
Stable binaries coming soon.