简体   繁体   English

如何查找磁盘卷的格式

[英]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.

相关问题 如何将磁盘的物理扇区映射到Mac OS X上的HFS +卷上包含它们的文件 - How does one map physical sectors of a disk to the files that contain them on an HFS+ volume on Mac OS X 如何在 MacOS 中使用命令行快速格式化磁盘 - How to quick format a disk using command line in MacOS 告诉文件所在的磁盘/卷 - Tell what disk/volume a file lives on 从代码确定卷是否是磁盘映像(DMG) - Determine if a Volume is a Disk Image (DMG) from code 在OSX上用磁盘卷名填充数组-带空格 - Populating array with disk volume names on OSX - with spaces 如何从目录ID和卷号中找到FSRef? - How to find an FSRef from a directory ID and a volume number? 如何在 Mac OS High Seirra/Mojave 中重新格式化已删除的卷 - How to re-format a deleted volume in Mac OS High Seirra/Mojave 使用磁盘仲裁框架时,是否有可靠的方法知道卷是时间机器卷? - Is there a reliable way to know a volume is a time machine volume when using the disk arbitration framework? 您如何使用Cocoa在已安装卷上找到可用空间量? - How do you find the amount of free space on a mounted volume using Cocoa? 哪些方法/调用执行磁盘I / O操作,以及如何找到它们? - Which methods/calls perform the disk I/O operations and how to find them?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM