Is there an easy way to get the serial number of all the hard disks in a Mac using an API?
Basically, I\'m looking for a unique identifier for the hard disk with whi
I think it's better to get the Volume UUID (which appears in the Disk Utility, for example.)
UUID can be obtained using the Disk Arbitration framework, which is slightly higher-level than IOKit and easier to use.
Create DADiskRef using DADiskCreateFromBSDName, and use DADiskCopyDescription to get the info dictionary, and look up the key kDADiskDescriptionMediaUUIDKey. Info on the mount point etc. can be obtained by statfs.
That said, it might be easier just to invoke the command-line utility diskutil with the option -plist to get the info in the plist format.
The sample code FSMegaInfo might also be instructive how to get much more info about a disk.