Apple Mac and fancy devices. LTO, SAS, Fiber Channel, eSATA

The topic of this article is to connect external devices to the Mac via SAS, Fiber Channel (FC), eSATA interfaces. Immediately make a reservation that for solving the problem of access to such devices, there is a healthy person's way: to assemble a cheap PC, stick an HBA SAS or FC controller card there (for example, the simplest LSI adapter), connect your devices to this controller, install any Linux on the PC and work from Mac through the network. But it is banal and uninteresting. We will go the way of hardcore and will connect our devices directly to the Mac.

What we will need for this:
- a decent amount of money to buy new equipment, or good luck in auctions on eBay (where, with a little effort, you can buy the required equipment of previous generations 10 times cheaper than the price list);
- this article.

To work with magnetic tape (currently almost universally represented by the LTO format), you must have a tape drive (tape drive) or a tape library of the LTO standard. This is a rather expensive device for the initial purchase (from hundreds of thousands of rubles), but worth the sane money when buying a used one. Since LTO generations change approximately every two years, and compatibility is limited to two generations, the secondary market is sufficiently saturated with efficient devices of four years or more, i.e. the year before last and beyond. If you buy a new device for commercial purposes, then you yourself understand why you need it. If you want to buy for home and family, you can consider this option as a way of archiving information (since the media itself is very cheap per 1 gigabyte).

Starting with the LTO-5 generation (and in part LTO-4), magnetic tape devices are connected to the computer via SAS or FC interface (usually there are two versions of each device).

On the other hand, Apple kindly provides us in our Mac USB-C interface (working via USB, Thunderbolt 3 or DisplayPort protocols), sometimes an Ethernet interface, as well as proprietary Thunderbolt 3 adapters - Thunderbolt 2 and Thunderbolt - FireWire 800. A

hopeless situation? Not really. Fortunately, the Thunderbolt bus can operate in PCIe mode and provide the ability to connect PCIe cards in the same way as if they were installed directly inside the computer case. Due to this, any extensions to the Mac hardware configuration are possible, there would be an appropriate adapter and drivers.

The conceptually simplest way to solve the problem is to use an external box for PCIe adapters with Thunderbolt (PCIe card expansion system) interface, in which you can install a controller (Host bus adapter, HBA) SAS or FC. For example, such boxes are produced by Sonnet and several others. There is a nuance: not every controller is suitable for us, but only having a driver for macOS. There are only a few such boards, and the cheapest and most popular (for example, the same LSI) are not included in their number. Fortunately, Sonnet had the trouble of compiling a PCIe card compatibility chart for various OSs through the Thunderbolt interface.

Another solution is to purchase a ready-made converter for the Thunderbolt-SAS or Thunderbolt-FC interface converter, which, in fact, is a ready-made assembly from the box and the controller. ATTO is best known in this area , but products from other companies are also found.

Note that not all SAS and FC controllers are certified to comply with the LTO standard, as this alone costs money. Some manufacturers directly write that the operation of their controllers with tape drives is not provided.

To complete the picture, we note that the company mLogic produces a device, which is an IBM LTO-8 drive in an external case, into which the SAS to Thunderbolt 3 converter is immediately integrated. This, however, is even more exotic than all of the above, especially by the standards of our area. I doubt that this device can even be legally imported into Russia (LTO drives contain cryptographic tools, and manufacturers such as IBM and HP, for this reason, receive FSB import permission for each model).

Further, we will consider for example a specific set of equipment, the owner of which the author became as a result of several successful acquisitions, but the general principle should be maintained for all options.

So we have the following equipment for working with tape:
- Apple Mac mini 2018 computer with macOS 10.15 Catalina, which has USB-C ports with support for Thunderbolt 3;
- Apple Thunderbolt 3 / Thunderbolt 2 adapter;
- Apple Thunderbolt 2 cable;
- ATTO ThunderLink SH 1068 interface converter (2 * Thunderbolt / 2 * SAS-2);
- SAS cable SFF-8088 - SFF-8088;
- tape drive LTO-5 IBM TS2350;
- LTO-5 cartridges, cleaning cartridge.

Now, as they say, with all this garbage we will try to take off.

Download the latest version of the ThunderLink SH 1068 driver from the ATTO website (apparently, for our convenience, it is combined with the SH 2068 driver and is located in section 2068, which is written only inside the driver archive itself) and the ATTO configuration utility.

image

The driver, of course, needs to be installed. Before such actions, the author advises always to do a snapshot of the APFS file system of the boot disk with the command

tmutil localsnapshot


or a backup copy of the boot disk, if there is HFS +. You never know what. Then it will be easy to roll back from a snapshot.

Further, an inexperienced, but prudent, mind will undoubtedly be inclined to carefully read the ATTO instructions for installing the driver and execute it. The result is tadam! - we get the operating system hanging at the boot stage. Here we can use a snapshot from which you can recover by calling Time machine from the recovery partition, or you can manually erase a sick kext from the kernel extension catalog from the same recovery partition (the author generally does not recommend doing this).

Why it happens? Because Apple took care of us. In recent versions of macOS, it’s not easy to take and embed extraneous code into the boot process. Good Apple programmers have blocked such destructive behavior. More precisely, they blocked it by half when the driver wait is introduced, but the driver itself is not, so everything just hangs.

What should a sophisticated mind do before installing a driver? First, give the command:

csrutil status


If in response to it we get:

System Integrity Protection status: enabled.


this means that good Apple programmers take care of us, so nothing will come of us until we turn off their wonderful protection. To do this, we reboot into the recovery partition (⌘R), call the terminal and give the command:

csrutil disable


After that, we reboot into the working system, and then we install the driver, and at the same time the ATTO configuration utility (in principle, the configuration utility is needed only for diagnostics and is not required during normal operation). In the process, when asked, we confirm the ATTO authorization in the system settings. After installation, you can again reboot into the recovery partition and give the command

csrutil enable


Apple takes care of us again.

Now we have a driver-supported interface to external SAS devices (or FC, if FC converter was used). But how to work with the tape at a logical level?

As is known to an inexperienced but erudite mind, any Unix-compatible system supports tape drives at the kernel level and the main system utilities, which primarily include mt (tape management) and tar (an archiver with support for working with tape archives) . However, what will the sophisticated mind specify? Any Unix-compatible system except macOS . Apple worried about us by removing support for tape devices from its code.

But is it really impossible to return this code by porting the standard open source open source utilities to macOS? The good news is that Tolis has already done this (a link to which I do not provide) in its Tolis Tape Tools product. The bad news is that the said company estimates the use of the results of its work at 399 US dollars. Estimates of this fact may be different, but the author personally is not prepared to pay someone 400 bucks for a code, for the most part written by completely different people and openly used since the 1970s, and therefore this issue is for the author considers closed. (By the way, there is a free IOSCSITape project on the same topic on the github in a vague state ).

Fortunately, there is an IBM corporation in the world whose commercial appetites are of a completely different scale, and therefore do not appear in every little thing. In particular, she developed the open-source LTFS tape file system, which is also distributed for macOS.

There is a nuance in that different tape device manufacturers release their own versions of LTFS that support their devices. Since the author uses the IBM tape drive, LTFS was also installed by IBM. Third-party drives may need their own LTFS ports. And there is a universal openLTFS implementation on github and homebrew.

It is important for us that LTFS uses the media partition function, and therefore can work with devices and cartridges, starting with the LTO-5 generation.

So, in our case, we download the IBM Spectrum Archive Single Drive Edition product for macOS from the IBM website, which just includes the LTFS implementation. Without any adventures, we install the product with our own installer. In the process, he also installs the FUSE package, and in the system settings you will have to confirm the authorization of a smart programmer named Anatol Pomozov, on which in this case the whole IBM depends. Respect and respect for this person.

It is advisable to immediately write the line: /Library/Frameworks/LTFS.framework/Versions/Current/etc/ltfs.conf.local:

option single-drive sync_type = time @ 1


specifying tape mounting by default with a reset of the recording buffer after 1 minute of inactivity (default 5 minutes).

image

Finally, everything is ready to connect. We connect the chain: Mac - T3 / T2 adapter - Thunderbolt cable - ATTO converter - SAS cable - tape drive (the choice of several ports on the Mac, the converter and the drive is unimportant). Turn on the power of the converter. Turn on the power of the tape drive. We are waiting for the initialization of the drive by its indication.

We give the command:

ltfs -o device_list


Hooray! We get (in the usual diagnostic manner for IBM):

307 LTFS14000I LTFS starting, LTFS version 2.4.2.0 (10418), log level 2.
307 LTFS14058I LTFS Format Specification version 2.4.0.
307 LTFS14104I Launched by "ltfs -o device_list".
307 LTFS14105I This binary is built for Mac OS X.
307 LTFS14106I GCC version is 4.2.1 Compatible Apple Clang 4.1 ((tags / Apple / clang-421.11.66)).
307 LTFS17087I Kernel version: Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root: xnu-6153.101.6 ~ 15 / RELEASE_X86_64.
307 LTFS17085I Plugin: Loading "iokit" tape backend.
Tape Device list :.
Device Name = 0, Vendor ID = IBM, Product ID = ULT3580-TD5, Serial Number = **********, Product Name = [ULT3580-TD5].


We insert the cartridge, wait for the download and format:

mkltfs -d 0 -nTest -r "size=10M/name=.DS_Store"


Here, the -d parameter specifies the number of the drive (always zero if it is the only one, but you can’t omit this command), -n is the name of the tape (you can omit it), and the -r parameter requires the contents of .DS_Store files not to exceed the size 10 megabytes, in the index (i.e., intended for directories) section of the tape instead of the data section.

The mysterious life in the tape drive has gone. We are waiting for a couple of minutes, we get the answer:

LTFS15000I Starting mkltfs, LTFS version 2.4.2.0 (10418), log level 2.
LTFS15041I Launched by «mkltfs -d 0 -nTest -r size=10M/name=.DS_Store».
LTFS15042I This binary is built for Mac OS X.
LTFS15043I GCC version is 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66)).
LTFS17087I Kernel version: Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64.
LTFS15003I Formatting device '0'.
LTFS15004I LTFS volume blocksize: 524288.
LTFS15005I Index partition placement policy: size=10M/name=.DS_Store.

LTFS11337I Update index-dirty flag (1) — NO_BARCODE (0x0x1021081e0).
LTFS17085I Plugin: Loading «iokit» tape backend.
LTFS30810I Opening a device through iokit driver (0).
LTFS30814I Vendor ID is IBM.
LTFS30815I Product ID is 'ULT3580-TD5 '.
LTFS30816I Firmware revision is H976.
LTFS30817I Drive serial is **********.
LTFS17160I Maximum device block size is 1048576.
LTFS11330I Loading cartridge.
LTFS30854I Logical block protection is disabled.
LTFS11332I Load successful.
LTFS17157I Changing the drive setting to write-anywhere mode.
LTFS15049I Checking the medium (mount).
LTFS30854I Logical block protection is disabled.
LTFS15010I Creating data partition b on SCSI partition 1.
LTFS15011I Creating index partition a on SCSI partition 0.
LTFS17165I Resetting the medium's capacity proportion.
LTFS11097I Partitioning the medium.
LTFS11100I Writing label to partition b.
LTFS11278I Writing index to partition b.
LTFS30808I READ_ATTR (0x8c) returns -20501.
LTFS30865I READ_ATTR returns Invalid Field in CDB (-20501) 0.
LTFS30836I Cannot read attribute (-20501).
LTFS11336I The attribute does not exist. Ignore the expected error.
LTFS17235I Writing index of NO_BARCODE to b (Reason: Format, 0 files) **********.
LTFS17236I Wrote index of NO_BARCODE (b, **********).
LTFS11337I Update index-dirty flag (0) — NO_BARCODE (0x0x1021081e0).
LTFS11100I Writing label to partition a.
LTFS11278I Writing index to partition a.
LTFS30808I READ_ATTR (0x8c) returns -20501.
LTFS30865I READ_ATTR returns Invalid Field in CDB (-20501) 0.
LTFS30836I Cannot read attribute (-20501).
LTFS11336I The attribute does not exist. Ignore the expected error.
LTFS17235I Writing index of NO_BARCODE to a (Reason: Format, 0 files) 9068025555.
LTFS17236I Wrote index of NO_BARCODE (a, **********).
LTFS15013I Volume UUID is: 3802a70d-bd9f-47a6-a999-eb74ffa67fc1.

LTFS15019I Volume capacity is 1425 GB.
LTFS30854I Logical block protection is disabled.
LTFS15024I Medium formatted successfully.


Mount the formatted tape:

sudo mkdir /Volumes/LTFS
sudo chmod 777 /Volumes/LTFS/
sudo ltfs /Volumes/LTFS


We get a couple more minutes of drive operation, diagnostics:

307 LTFS14000I LTFS starting, LTFS version 2.4.2.0 (10418), log level 2.
307 LTFS14058I LTFS Format Specification version 2.4.0.
307 LTFS14104I Launched by «ltfs /Volumes/LTFS/».
307 LTFS14105I This binary is built for Mac OS X.
307 LTFS14106I GCC version is 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66)).
307 LTFS17087I Kernel version: Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64.
307 LTFS14063I Sync type is «time», Sync time is 60 sec.
307 LTFS17085I Plugin: Loading «iokit» tape backend.
307 LTFS17085I Plugin: Loading «unified» iosched backend.
307 LTFS14095I Set the tape device write-anywhere mode to avoid cartridge ejection.
307 LTFS30810I Opening a device through iokit driver (0).
307 LTFS30814I Vendor ID is IBM.
307 LTFS30815I Product ID is 'ULT3580-TD5 '.
307 LTFS30816I Firmware revision is H976.
307 LTFS30817I Drive serial is **********.
307 LTFS17160I Maximum device block size is 1048576.
307 LTFS11330I Loading cartridge.
307 LTFS30854I Logical block protection is disabled.
307 LTFS11332I Load successful.
307 LTFS17157I Changing the drive setting to write-anywhere mode.
307 LTFS11005I Mounting the volume.
307 LTFS30854I Logical block protection is disabled.
307 LTFS17227I Tape attribute: Vendor = IBM.
307 LTFS17227I Tape attribute: Application Name = LTFS.
307 LTFS17227I Tape attribute: Application Version = 2.4.2.0.
307 LTFS17227I Tape attribute: Medium Label =.
307 LTFS17228I Tape attribute: Text Localization ID = 0x81.
307 LTFS17227I Tape attribute: Barcode =.
307 LTFS17227I Tape attribute: Application Format Version = 2.4.0.
307 LTFS17228I Tape attribute: Volume Lock Status = 0x00.
307 LTFS17227I Tape attribute: Media Pool name =.
307 LTFS14111I Initial setup completed successfully.
307 LTFS14112I Invoke 'mount' command to check the result of final setup.
307 LTFS14113I Specified mount point is listed if succeeded.


And here she is, our tape on the desktop, called Test (ltfs)! The nameless tape will receive the name OSXFUSE Volume 0 (ltfs).

Now you can work with her.

image

Actually, you should keep in mind that it is advisable not to abuse the viewing of the contents of the tape directories in the windows of the finder, since this is an incredibly expensive operation for LTFS, but it is better to work with terminal commands, or just dump the backup directory in bulk to the tape, as shown in the window above.

By the way, there is a specially written IBM utility ltfs_copy and its clones designed for more efficient copying between tape and disk, but so far the author has not been able to find them in the public domain during surface searches.

You can unmount the tape with the command:

umount /Volumes/LTFS


or just throw it in the basket.

Actually, there are some kind of graphic shells for macOS in nature to facilitate these actions, but are we, after such perversions, afraid to type a few lines in the terminal?

As a side effect, we get the opportunity to connect external eSATA drives via a SAS / 4 * eSATA cable.

image

All Articles