Persistent file IDs

Hi everybody,


In the project I am currently working on, I need to know for each mounted volume if it supports "persistent file IDs" (ino_t).

With "persistent file IDs", I mean file ids which do not change each time a volume is mounted.

Some virtual file systems however like ones based on OSXFuse do not support persistent file IDs.

For now, the only way I found in order to recognize if a given volume supports persistent file IDs was to use the DiskArbitration API: DADiskCopyDescription() and read the value of field DAVolumeKind. Its value can be 'hfs' for HFS volumes, 'apfs', 'smbfs', etc. For generic OSXFuse volumes it is 'osxfuse', and for GoogleDrive File Stream, 'dfsfuse_DFS'. This solution works, but it is not generic.


Hence I would like to know if there is a generic way to "ask" a given volume if it supports persistent file IDs.


Unfortunately, DADiskCopyDescription() returns very few information for virtual file systems. For a generic OSXFuse volume we get only this:


{
     DAVolumeKind = osxfuse;
     DAVolumeMountable = 1;
     DAVolumeName = LoopbackFS;
     DAVolumeNetwork = 1;
     DAVolumePath = "file://localhost/Volumes/loop/";
}


Thanks in advance for any idea,

Marc

Accepted Reply

There’s a volume capability flag,

VOL_CAP_FMT_PERSISTENTOBJECTIDS
, that you can get via
getattrlist
. Most folks access this via the
NSURLVolumeSupportsPersistentIDsKey
provided by
NSURL
.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

There’s a volume capability flag,

VOL_CAP_FMT_PERSISTENTOBJECTIDS
, that you can get via
getattrlist
. Most folks access this via the
NSURLVolumeSupportsPersistentIDsKey
provided by
NSURL
.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Thanks a lot Quinn!


I have gone the simpler NSURL way using NSURLVolumeSupportsPersistentIDsKey, and I get the expected results.

(I will try the getattrlist() way later as an exercise.)


Sincerely,

Marc