[英]How to find the format of a disk volume
I am updating a backup utility I have written and have on the Mac App store. 我正在更新我编写的备份实用程序并在Mac App Store上有。
In a Macintosh Cocoa application, how do I find how a disk volume is formatted? 在Macintosh Cocoa应用程序中,如何查找磁盘卷的格式? The only official thing I find, is doing a GetResourceValue: for 'NSURLVolumeLocalizedFormatDescriptionKey', but that is language dependent.
我找到的唯一正式的事情是做一个GetResourceValue:对于'NSURLVolumeLocalizedFormatDescriptionKey',但这是依赖于语言的。
My utility does not support volumes formatted for FAT32. 我的实用程序不支持为FAT32格式化的卷。 My utility needs to do special handling for XSan drives.
我的实用程序需要对XSan驱动器进行特殊处理。
statfs(2)
will give you a non-localized name: statfs(2)
将为您提供非本地化的名称:
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
. 有关将在
f_fstypename
返回的名称,请参见/System/Library/Filesystems
。
This question has been answered but I'll throw my 2 cents in... 这个问题已经回答了,但我会把我的2美分扔进...
/sbin/mount | grep acfs | awk '{print $3}'
This outputs 这输出
/Volumes/XsanVolumeName1
/Volumes/XsanVolumeName2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.