On the command line, you can use the ioreg
tool to explore the IO Kit registry. For Lion or Older, you can also use the convenient IORegistryExplorer GUI tool from Apple's Hardware IO Tools package. (it crashes on Mountain Lion)
For looking at internal hard drive properties, this is a pretty good start:
ioreg -irc IOAHCIBlockStorageDevice -w 0
Which on my MacBook Air yields:
+-o IOAHCIBlockStorageDevice <class IORegistryEntry:IOService:IOBlockStorageDevice:IOAHCIBlockStorageDevice, id 0x100000216, registered, matched, active, busy 0 (472 ms), retain 7>
| {
| "IOCFPlugInTypes" = {"24514B7A-2804-11D6-8A02-003065704866"="SMARTLib.plugin"}
| "device-type" = "Generic"
| "IOStorageFeatures" = {"Unmap"=Yes}
| "Device Characteristics" = {"Logical Block Size"=512,"Product Name"="APPLE SSD TS256C ","Medium Type"="Solid State","Physical Block Size"=512,"SATA Features"=23,"Serial Number"=" X06S10H7THRZ","Product Revision Level"="CJAA0201"}
| "Protocol Characteristics" = {"Physical Interconnect"="SATA","Physical Interconnect Location"="Internal"}
| "SMART Capable" = Yes
| "IOMinimumSegmentAlignmentByteCount" = 4
| }
|
+-o IOBlockStorageDriver <class IORegistryEntry:IOService:IOStorage:IOBlockStorageDriver, id 0x100000219, registered, matched, active, busy 0 (471 ms), retain 8>
+-o APPLE SSD TS256C Media <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x10000021a, registered, matched, active, busy 0 (471 ms), retain 11>
+-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x10000021b, registered, matched, active, busy 0 (0 ms), retain 6>
+-o IOGUIDPartitionScheme <class IORegistryEntry:IOService:IOStorage:IOPartitionScheme:IOGUIDPartitionScheme, id 0x10000021d, !registered, !matched, active, busy 0 (3 ms), retain 8>
+-o EFI system partition@1 <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x100000263, registered, matched, active, busy 0 (0 ms), retain 9>
| +-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x100000266, registered, matched, active, busy 0 (0 ms), retain 6>
+-o Customer@2 <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x100000264, registered, matched, active, busy 0 (2 ms), retain 11>
| +-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x100000267, registered, matched, active, busy 0 (0 ms), retain 7>
+-o Recovery HD@3 <class IORegistryEntry:IOService:IOStorage:IOMedia, id 0x100000265, registered, matched, active, busy 0 (3 ms), retain 9>
+-o IOMediaBSDClient <class IORegistryEntry:IOService:IOMediaBSDClient, id 0x100000268, registered, matched, active, busy 0 (0 ms), retain 6>
You can get at these properties programmatically via the IOKit user library as you've already discovered for USB.
At a somewhat higher level, some of the information is also available via the Disk Arbitration Framework, via the DADiskCopyDescription
function. The device properties exposed via this function don't seem to be documented outside the DADisk.h
header file, but they're fairly self-explanatory, e.g.:
extern const CFStringRef kDADiskDescriptionDeviceGUIDKey; /* ( CFData ) */
extern const CFStringRef kDADiskDescriptionDeviceInternalKey; /* ( CFBoolean ) */
extern const CFStringRef kDADiskDescriptionDeviceModelKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDevicePathKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDeviceProtocolKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDeviceRevisionKey; /* ( CFString ) */
extern const CFStringRef kDADiskDescriptionDeviceUnitKey; /* ( CFNumber ) */
extern const CFStringRef kDADiskDescriptionDeviceVendorKey; /* ( CFString ) */