This page only applies to HP LTO tape drives, the last of which was for the LTO6 technology. Later drives (including those HP branded) are manufactured and designed by IBM, and use IBM’s software, which includes command line management tools.
Introduction
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. IBM’s implementation of LTFS one other hand includes all of the necessary command line tools, but it only works on IBM drives.
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.
Using ltfscmd.exe
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:
Limitations
- 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.
Download
At present this tool is still under development. The source code can be viewed here on Github.
Stable binaries coming soon.
Thanks for this info. I try to rarely use windows, but need it for a couple things. Tape drives in particular. Otherwise I use Linux for everything
Looks very promising. Any ETA in regard to binaries?
Never compiled with VS before, so not familiar with the process.
Happy to beta test if needed.
Would love to use this to automate some of our repetitive work without having to resort to slow GUI operation.
Try this: http://xpander.mattmillman.com/files/ltfscmd.zip
There is an outstanding issue with the checkmedia command – if you run it while LTFS is accessing the drive it can sometimes cause a lock up. not straight forward to fix, haven’t had time to look at it.
Hey, very nice tool!
I ran into a prblem where it says “Cannot start file system. LTFS not running” after sending ltfscmd -o load -d DRIVE:
Any ideas? Using Windows 7.
Does the GUI work for that same drive letter?
Hello
Do you have any documentation on how to run the code on windows and what are the requirements?
So when are we going to see some binary’s? Just started deployment of LTO on windows and dire lack of CLI tools is wonderful…
There is a link to a build earlier in the comments.
That link is dead, hence my inital comment…
It is back. You can go vent about something else now 🙂
Thank you very much!
You write that mkltfs’/’unltfs’ can be used for formatting. But these commands do not exist on Windows Server 2019 when only HP OpenStor is installed. Where can I get them for Windows?
I am referring to the HP version of LTFS which was current when I wrote the article. Not sure what OpenStor is.
Unfortunately, it’s not working for me. When I tried to use “ltfscmd -o eject -d L:” or even “ltfscmd -o listmappings,” it couldn’t find any mappings. Thx.
I would like to know that how to change partition in ltfs like it have 2 partitions index and data while reading data from tape i am only able to retrive data from index partition. Can anyone tell me is there any command or anything to jump from index to data partition kindly help me.
Or simply give me an email.
Devlopur@proton.me