I'm working on a project that links drives (and their associated stats, such as those displayed by iostat
) and partitions to mount points, but running into issues with the way OS X does the Fusion Drive.
I have been able to gather information on drives and partitions from the IO Registry and Disk Arbitration Framework. Similarly, I have been able to correlate drives and mount points using statfs (or the mount
or df
commands). However, there is a missing link where the Fusion Drive enters the picture. Here's a sample output of diskutil list
:
$ diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage Macintosh HD 999.7 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1 (internal, virtual):
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD +999.3 GB disk1
Logical Volume on disk0s2
FA33A826-C98E-425A-BCF1-9A68A926D36E
Unlocked Encrypted
The IORegistry statistics from iostat
(reads/writes/bytes read/bytes written,time spent transferring, etc.) are associated with disk0
in the above output. However, df
(or equivalent programmatic statfs functions) associates the /
mount point with /dev/disk1
:
$ df
Filesystem 512-blocks Used Available Capacity iused ifree %iused Mounted on
/dev/disk1 1951825920 575057552 1376256368 30% 71946192 172032046 29% /
I want to be able to correlate reads/writes on the filesystem at /
with the physical drive disk0
. I've spent several hours searching here and elsewhere for any way to associate disk1
with disk0s2
. The source code for diskutil
is apparently in the DiskManagement
Framework, which is not public.
Is there any way, other than textually parsing the output of the above diskutil list
command, to associate a mounted (virtual) fusion drive with its underlying (physical) partition?
After a few more hours of digging, I uncovered the key fact that Fusion Drives (as well as the full-disk FileVault encryption introduced in Lion) utilize a feature called "Core Storage" (or CoreStorage) where one or more physical disks/partitions is linked to a virtual disk.
There does not seem to be any publicly available API to obtain CoreStorage information programmatically, and what commands there are are sparsely documented.
While still a command line, diskutil cs list
provides sufficient parseable information to make the connections I need.
A PDF with examples and a lot more information can be found here.