Hi, i have made some code in Swift that allows me to get a list of the storage disks and the relative partitions present in a mac (everything made using the IOKit api), this of course includes the APFS containers that are managed by the OS as separate storage devices.
To have a proper representation of the partitions tree in my code i need to know which are the actual partitions housing a given APFS container.
I have tried to look for this information on documentation and on the internet, then into the IORegistry (using the registry explorer app) and searching for this info into the description dictionaries provided by Disk arbitration but so far no luck, even by comparing the UUIDs.
In IORegistry explorer in the IOService plane I can also see that the APFS Container in my mac's ssd is listed as a sub-node of it's physical storage a partition, but since i am using an IOIterator object to scan the IORegistry i have no idea of how i should look into sub-nodes for a given node.
Also i think that some particular storage configurations might have an APFS container split across multiple physical storage devices, in fact the diskutil list -plist
command shows the physical store for each APFS containers as an array in the plist output, so the child approach might not be effective there.
So how can i do this?
I am doing all of this stuff because i am working to a sandbox-friendly open source swift package for macOS apps to easily get a complete tree structure of disks and partitions, in a similar fashion to the above mentioned diskutil list -plist
command, my goal is actually to have the exact same structure provided by that command, with the same info.