I am updating a backup utility I have written and have on the Mac App store.
In a Macintosh Cocoa application, how do I find how a disk volume is formatted? The only official thing I find, is doing a GetResourceValue: for 'NSURLVolumeLocalizedFormatDescriptionKey', but that is language dependent.
My utility does not support volumes formatted for FAT32. My utility needs to do special handling for XSan drives.
statfs(2)
will give you a non-localized name:
struct statfs volinfo;
if(statfs("/path/to/your/volume", &volinfo) != 0)
{
perror("statfs");
return -1;
}
fprintf(stderr, "%s\n", volinfo.f_fstypename);
See /System/Library/Filesystems
for the names that will be returned in f_fstypename
.