Skip to content

Max OS X kernel driver for providing access to external drive SMART data

Notifications You must be signed in to change notification settings

eitschpi/OS-X-SAT-SMART-Driver

 
 

Repository files navigation

OS X SAT SMART Driver
#####################

This is a kernel driver for Mac OS X external USB or FireWire drives.
It extends the standard driver behaviour by providing access to drive
SMART data. The interface to SMART data is same as with ATA family
driver, so most existing applications should work. 

The driver should work with Snow Leopard and Lion. People have
reported problems with Mountain Lion. The driver requires a SAT (SCSI
ATA Translation) capable external drive enclosure.

The code is based on Apple opensource files and is therefore published
under Apple Public Source License. For details see
http://www.opensource.apple.com/license/apsl/

Install
=======
 
 * Unmount external drives
 * Use the dmg image and the installer
 * Check DiskUtility. The disks should have "S.M.A.R.T. Status: Verified"


Uninstall
=========

 * Remove driver and plugin
    sudo rm -r /System/Library/Extensions/SATSMARTDriver.kext
    sudo rm -r /System/Library/Extensions/SATSMARTLib.plugin
 * Reboot


Compile
=======

 * Compile all targets using XCode.
    cd SATSMARTDriver
    xcodebuild -configuration Release

 * Unmount all existing external drives.

 * Load the kernel extension.
    sudo tail -f /private/var/log/kernel.log &
    cd build/Debug/
    sudo cp -R SATSMARTLib.plugin /System/Library/Extensions
    sudo cp -R SATSMARTDriver.kext /tmp
    sudo kextutil -t /tmp/SATSMARTDriver.kext

 * The external drives should mount automatically. Check them briefly
   and unmount them.

 * Test
    ./smart_status

    ./smart_sample -a

 * Check DiskUtility. The disk should have "S.M.A.R.T. Status: Verified"

 * Install the driver to system permanently
    sudo cp -R SATSMARTDriver.kext  /System/Library/Extensions

 * Reboot

 * If you want to limit the driver for certain hardware add product 
   and vendor identification to SATSMARTDriver/Info.plist. For example:
			<key>Product Identification</key>
			<string>External</string>
			<key>Vendor Identification</key>
			<string>Generic</string>
   You can find out the identification string from io registry:
       ioreg -r -c IOSCSIPeripheralDeviceNub
..
+-o IOSCSIPeripheralDeviceNub  <class IOSCSIPeripheralDeviceNub, id 0x100000256$
  | {
  |   "IOProviderClass" = "IOSCSIProtocolServices"
  |   "Protocol Characteristics" = {"Physical Interconnect"="USB","Physical Int$
  |   "IOMatchCategory" = "SCSITaskUserClientIniter"
  |   "Product Revision Level" = "2.02"
  |   "IOProbeScore" = 0
  |   "Product Identification" = "External"
  |   "CFBundleIdentifier" = "com.apple.iokit.IOSCSIArchitectureModelFamily"
  |   "Vendor Identification" = "Generic"
  |   "IOClass" = "IOSCSIPeripheralDeviceNub"
  |   "Peripheral Device Type" = 0
  | }
..

*** 20120521 RJVB
I created a fork (https://github.com/RJVB/OS-X-SAT-SMART-Driver) that works with enclosures that weren't supported before, in 64bit. I'd of course be more than happy to see my tweaks included in your code (possibly a branch)!

- some code cleanup
- use NULL instead of 0 or 0L when pointers/addresses are concerned
- accept CHECK_CONDITION request status when reading SMART data. My guess is that this is comparable to the smartmontools' "-T permissive" option.
what about PASS_THROUGH_16()? The function is defined but unused; is it a 'drop-in' replacement for PASS_THROUGH_12() and if so, could one issue the 16 variant after the 12 variant failed in hope of supporting more enclosures?

About

Max OS X kernel driver for providing access to external drive SMART data

Resources

Stars

Watchers

Forks

Packages

No packages published