Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#25 closed enhancement (worksforme)

SCSI pass through for SMART via USB on MacOSX smartmontools? 3rd party code available!

Reported by: putzfetzenorg Owned by: cooties
Priority: minor Milestone:
Component: all Version: 5.39
Keywords: macosx Cc: kvs

Description

Dear smartmontools developers!

Until the very recent version of smartmontools (5.39), SMART through USB was not possible on Mac OS X, because the Mac OS X kernel does not support SCSI pass through (reasoning of Christian Franke).

Meanwhile I googled for:
http://www.google.com/search?q=mac+osx+scsi+passthrough+usb

And found a person, who wrote a SCSI pass through driver for Mac OS X:
http://tinyco.de/2009/02/04/writing-a-mac-osx-usb-device-driver-with-scsi-pass-through.html

In the site's comment section I asked as Stefan Nowak whether this code could be used for passing through SMART:
http://tinyco.de/2009/02/04/writing-a-mac-osx-usb-device-driver-with-scsi-pass-through.html#comment-24129787

And the developer answered within the site's comment section as wagerlabs, that it should work:
http://tinyco.de/2009/02/04/writing-a-mac-osx-usb-device-driver-with-scsi-pass-through.html#comment-24130057

I don't know low-level coding, otherwise I would offer my help. Please, dear Darwin related smartmontools developers: Could you built SMART through USB support into the Mac version of smartmontools?

Regards, Stefan Nowak

Change History (30)

comment:1 by putzfetzenorg, 15 years ago

Summary: SCSI pass through for SMART via USB on MacOSX Rsync? 3rd party code available!SCSI pass through for SMART via USB on MacOSX smartmontools? 3rd party code available!

comment:2 by Christian Franke, 15 years ago

Version: 5.39

comment:3 by cooties, 14 years ago

Owner: changed from somebody to cooties
Status: newaccepted

comment:4 by putzfetzenorg, 14 years ago

@cooties: You took ownership and accepted the feature request. So can I hope that this feature will be realised? Are you already working on it? Curious...

comment:5 by Christian Franke, 14 years ago

Keywords: macosx added; mac usb scsi-pass-through removed

comment:6 by porg, 14 years ago

Any news?

comment:7 by kvs, 14 years ago

Cc: kvs added

Would http://www.makemkv.com/download/daspi/ be of any help? It's described as a SCSI passthrough driver, but only for CD/DVDs. I don't know if that's an artificial limitation, but maybe it'd be a starting point?

comment:8 by porg, 14 years ago

@kvs: I can't tell. I started the request. But eventually only some low level savvy programmers can implement it.

@Dear pro folk: Can the "tinyco" or "daspi" drivers be integrated to achieve SCSI pass through?

comment:9 by kasperx, 13 years ago

Would you try this out: https://github.com/kasbert/OS-X-SAT-SMART-Driver ?

I use Snow Leopard (OS X 10.6.8), but it should work with other versions, too.

comment:10 by rjvbertin, 13 years ago

I've had to tweak kasperx's driver a little bit, but now smartmontools can indeed access the SMART data on compatible devices, over USB and FW800 (MBP 13" under OS X 10.6.8; 64bit mode).

in reply to:  10 comment:11 by Christian Franke, 13 years ago

Replying to rjvbertin:

... but now smartmontools can indeed access the SMART data on compatible devices, over USB and FW800 ...

Does this require any enhancements to os_darwin.cpp ? If yes, please provide the patch as an attachment.

comment:12 by rjvbertin, 13 years ago

No, apparently the claim in the kext documentation is correct that it functions transparently. From what I understand it looks like it only does the equivalent of -d sat,12 though (maybe that's why I've gotten my enclosure to work by accepting a CHECK_CONDITION status return when trying to read SMART data?).

It also looks like I'd have to contact the developer to get my tweaks committed.

comment:13 by porg, 13 years ago

I'd like to beta-test this, if it is of help.
Could you please provide a source-code or binary package?
Thanks!

comment:14 by rjvbertin, 13 years ago

With pleasure: check the DMG at https://github.com/RJVB/OS-X-SAT-SMART-Driver .

comment:15 by porg, 13 years ago

Thanks. Now before I go into hours of trial'n'error, could you please give instructions on how to use this driver extension in conjunction with smartctl. Thanks.

As far as I understand now:
1) Install the driver extension. (Description says this does not affect USB/Firewire transfer, but only extend the driver to support the pass-through)
2) Attach USB/Firewire drive.
3) smartmontools <which-options-?> <which-addressing-?>

comment:16 by rjvbertin, 13 years ago

Indeed. Unmount any external drives you may have mounted before installing the driver extension. Then install, attach/mount the external, and execute smartctl -a /dev/diskN where N is the number attributed to your external. (You'd obtain the appropriate device by executing mount or df in a shell.)

From what I've seen there's no need to use smartctl's -d option - I guess the driver presents all supported hardware as ATA drives even if it's SATA inside.

BTW: neither SAT-SMART-DRIVER nor smartmontools@linux recognise my OWC ATA enclosure, while it is recognised by SpeedFan under MS Windows. Sadly, my desktop enclosure (a DMI/Storeva SilverDrive) doesn't appear to support SMART at all, and it's the oldest disk I currently use...

in reply to:  16 ; comment:17 by Christian Franke, 13 years ago

ATA and SATA SMART commands are the same.

The OWC enclosure (USB ID?) likely supports some vendor specific pass-through command which may or may not be supported by smartmontools. Please try smartctl -d usbcypress or usbjmicron or usbsunplus under Linux or Windows (This won't work on Mac OS X because this driver does not provide real SCSI pass-through functionality).

comment:18 by porg, 13 years ago

I report: Total success with all my USB + Firewire drives!

Test results in detail:

Remarks:

  • USB IDs were obtained from Mac OS X System Profiler.
  • Model family + device model was autodetected by smartctl!

Raidsonic Icy Box USB PATA 2.5 inch enclosure

USB-Product-ID: 0x2329
USB-Producer-ID: 0x152d (JMicron Technology Corp.)
Device Model: TOSHIBA MK5055GSX

Western Digital My Book (Interfaces: USB2, Firewire 800, eSATA)

USB-Product-ID: 0x1103
USB-Producer-ID: 0x1058 (Western Digital Technologies, Inc.)
Model Family: Western Digital Caviar Green family
Device Model: WDC WD10EACS-00ZJB0
Remark: Passthrough worked through both USB as well as Firewire.

comment:19 by porg, 13 years ago

Wow! This is a major improvement for smartmontools on the Macintosh platform!

So how to proceed?
Include this driver as an optional package within the smartmontools Mac package?
If not, please at least add the info about this passthrough driver into the readme and changelog.

in reply to:  17 ; comment:20 by rjvbertin, 13 years ago

Replying to chrfranke:

The OWC enclosure (USB ID?) likely supports some vendor specific pass-through command which may or may not be supported by smartmontools. Please try smartctl -d usbcypress or usbjmicron or usbsunplus under Linux or Windows (This won't work on Mac OS X because this driver does not provide real SCSI pass-through functionality).

The OWC is a ProductID 0x0072, VendorID 0x0dc4 . It (or the disk) requires more power than my MBP provides on the USB ports so I need to power it via FW if I want to access it from Linux or MSWin VM guests. One day ...
In the meantime, if ATA and SATA SMART commands are the same, something must be different enough (the way to issue them?) that under Linux, -d ata works and -d sat,N doesn't, for one of my enclosures (which has SATA inside).

in reply to:  19 comment:21 by Christian Franke, 13 years ago

Replying to porg:

Include this driver as an optional package within the smartmontools Mac package?

We don't provide Mac packages, please request this from your favorite package provider.

If not, please at least add the info about this passthrough driver into the readme and changelog.

I added a news entry to the homepage. If possible, please provide some more detailed info that we could add to section 1.G of the INSTALL file.

in reply to:  18 ; comment:22 by Christian Franke, 13 years ago

Replying to porg:

I report: Total success with all my USB + Firewire drives!
...
Raidsonic Icy Box USB PATA 2.5 inch enclosure

USB-Product-ID: 0x2329
USB-Producer-ID: 0x152d (JMicron Technology Corp.)

Are you sure that this device actually supports SAT? AFAIK the (older) JMicron bridges only support the JMicron specific pass-through command which is not supported by the SAT-SMART-Driver.

in reply to:  20 comment:23 by Christian Franke, 13 years ago

Replying to rjvbertin:

In the meantime, if ATA and SATA SMART commands are the same, something must be different enough (the way to issue them?) that under Linux, -d ata works and -d sat,N doesn't, for one of my enclosures (which has SATA inside).

On Linux, -d ata issues ATA commands using HDIO_DRIVE_TASKFILE ioctl, -d sat,N issues same ATA commands via SCSI command SAT PASS-THROUGH(N) using SG_IO ioctl.

comment:24 by rjvbertin, 13 years ago

I guess the fact that I'm running Linux in a VM (VirtualBox) on a host which doesn't have SCSI pass through may matter here...

comment:25 by kasperx, 13 years ago

Could you try using SniffUSB in Windows to analyze OWC enclosure protocol ?

comment:26 by rjvbertin, 13 years ago

Ok, what should I do exactly? Just mounting the drive gave me a logfile that seemed to grow without bounds - is that normal?

in reply to:  22 comment:27 by porg, 13 years ago

Replying to chrfranke:

Replying to porg:

I report: Total success with all my USB + Firewire drives!
...
Raidsonic Icy Box USB PATA 2.5 inch enclosure

USB-Product-ID: 0x2329
USB-Producer-ID: 0x152d (JMicron Technology Corp.)

Are you sure that this device actually supports SAT? AFAIK the (older) JMicron bridges only support the JMicron specific pass-through command which is not supported by the SAT-SMART-Driver.

I am certain that it works, because I saved the previous output (from the Windows machine) into a text file, and compared it with the current Macintosh output, and the values such as Power_on_hours have increased accordingly. So yes: It definitely worked.

comment:28 by Christian Franke, 13 years ago

This means that -d sat should also work for this device on Linux and Windows. By default smartctl uses -d usbjmicron for 0x152d:0x2329 (see drivedb.h).

comment:29 by Christian Franke, 12 years ago

Resolution: worksforme
Status: acceptedclosed

SMART support for SAT capable USB and Firewire devices is now available through the OS X SAT SMART Driver. A note was added to smartmontools documentation in r3555.

SCSI/SAS disks, non-SMART ATA/SATA commands and non-SAT USB bridges are still unsupported. Please create a new ticket if full fledged ATA or SCSI pass-through support is available for Mac OS.

comment:30 by porg, 12 years ago

Thanks!

Note: See TracTickets for help on using tickets.