为什么我不能打开驻留在只读NFS文件系统上的DMG文件?


15

我发现了一个奇怪的问题......如果我有一个驻留在只读NFS共享上的磁盘映像文件(DMG),我无法在Mac OS X 10.7.5中打开它们。通过AFP访问时,相同的文件打开正常。但是,尝试使用hdiutil attach它们在NFS共享时打开它们会导致“附加失败 - 只读文件系统”:

bash-3.2# /usr/bin/hdiutil attach /Volumes/nfs_share/Some.dmg
hdiutil: attach failed - Read-only file system

即使AFP共享是只读的,我也可以附加相同的图像。但由于某种原因,只读NFS共享不起作用。

最终我想要做的是用影子文件附加图像将只读图像作为读写安装。但这也失败了:

bash-3.2# /usr/bin/hdiutil attach /Volumes/nfs_share/Some.dmg -mountpoint /Somewhere -shadow /path/to/Some-Shadow
hdiutil: attach failed - Read-only file system

同样,如果通过AFP提供图像,这种方法也很有效。如果NFS共享是读写的,它也可以正常工作,但出于安全考虑,我不能这样做。

如何挂载驻留在只读NFS共享上的DMG文件?


附加信息:

/etc/exportsFreeNAS(FreeBSD 8.2-RELEASE-p7)服务器上的相关行:

/mnt/raid/netboot -alldirs -ro -mapall=netboot:netboot -network 10.100.0.0/16

输出/usr/bin/hdiutil attach -verbose /Volumes/netboot/Lion.nbi/Library.dmg -notremovable -shadow /private/var/netboot/Library-Shadow -owners on -noverify -noautofsck -nobrowse

Initializing…
DIBackingStoreInstantiatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score      100, CCarbonBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  6, score    -1000, CVectoredBackingStore
CBSDBackingStore::newProbe stat() failed.  No such file or directory.
DIBackingStoreInstantiatorProbe: interface  0, score        1, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score    -1000, CCarbonBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  6, score    -1000, CVectoredBackingStore
DIBackingStoreInstantiatorProbe: interface  0, score      100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: interface  1, score    -1000, CBundleBackingStore
DIBackingStoreInstantiatorProbe: interface  2, score    -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: interface  3, score      100, CCarbonBackingStore
DIBackingStoreInstantiatorProbe: interface  4, score    -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: interface  5, score    -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: interface  6, score    -1000, CVectoredBackingStore
Attaching…
Error 30 (Read-only file system).
Finishing…
DIHLDiskImageAttach() returned 30
hdiutil: attach failed - Read-only file system

rpcinfo -pNFS服务器上的输出:

   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
    100005    1   udp    967  mountd
    100005    3   udp    967  mountd
    100005    1   tcp    967  mountd
    100005    3   tcp    967  mountd
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100024    1   udp    689  status
    100024    1   tcp    689  status
    100021    0   udp    616  nlockmgr
    100021    0   tcp    927  nlockmgr
    100021    1   udp    616  nlockmgr
    100021    1   tcp    927  nlockmgr
    100021    3   udp    616  nlockmgr
    100021    3   tcp    927  nlockmgr
    100021    4   udp    616  nlockmgr
    100021    4   tcp    927  nlockmgr

输出mount在Mac OS X 10.7.5客户端上:

/dev/disk1s2 on / (hfs, local)
devfs on /dev (devfs, local, nobrowse)
afp_0egBhf12TAP01SptRt47XSdj-3.2c000002 on /private/var/netboot (afpfs, nobrowse)
afp_0egBhf12TAP01SptRt47XSdj-4.2c000004 on /Network/Applications (afpfs, read-only)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
afp_0egBhf12TAP01SptRt47XSdj-4.2c000008 on /Network/Servers/chef.farcry.sitepalette.com/Users (afpfs, nodev, nosuid, automounted, nobrowse, mounted by jnet)
afp_0egBhf12TAP01SptRt47XSdj-4.2c000009 on /Volumes/Users (afpfs, nodev, nosuid, mounted by jnet)
10.100.1.2:/mnt/raid/netboot on /Volumes/netboot (nfs)

最后,输出/usr/bin/hdiutil attach -debug /Volumes/netboot/Lion.nbi/Library.dmg -notremovable -shadow /private/var/netboot/Library-Shadow -owners on -noverify -noautofsck -nobrowse

calling DIHLDiskImageAttach with 
skip-verify: true
auto-fsck: false
drive-options:
quiet: false
shadow-url: file://localhost/private/var/netboot/Library-Shadow
mount-nobrowse: true
enable-owners: true
verbose: false
debug: true
agent: hdiutil
fixed-disk: true
image-options:
main-url: file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
2012-11-27 12:02:23.053 hdiutil[23401:707] DIHLDiskImageAttach: input dictionary {
    agent = hdiutil;
    "auto-fsck" = 0;
    debug = 1;
    "drive-options" =     {
    };
    "enable-owners" = 1;
    "fixed-disk" = 1;
    "image-options" =     {
    };
    "main-url" = "file://localhost/Volumes/netboot/Lion.nbi/Library.dmg";
    "mount-nobrowse" = 1;
    quiet = 0;
    "shadow-url" = "file://localhost/private/var/netboot/Library-Shadow";
    "skip-verify" = 1;
    verbose = 0;
}
2012-11-27 12:02:23.054 hdiutil[23401:707] DIHLDiskImageAttach: disabling legacy image format attach
2012-11-27 12:02:23.055 hdiutil[23401:707] DIHLDiskImageAttach: newImagekeys = {
    "legacy-disabled" = 1;
}
2012-11-27 12:02:23.055 hdiutil[23401:707] DIHLDiskImageAttach: creating DIHelperProxy
2012-11-27 12:02:23.056 hdiutil[23401:707] with dictionary: {
    agent = hdiutil;
    "auto-fsck" = 0;
    debug = 1;
    "drive-options" = <62706c69 73743030 d0080000 00000000 01010000 00000000 00010000 00000000 00000000 00000000 0009>;
    "enable-owners" = 1;
    "fixed-disk" = 1;
    "image-options" = <62706c69 73743030 d101025f 100f6c65 67616379 2d646973 61626c65 6409080b 1d000000 00000001 01000000 00000000 03000000 00000000 00000000 00000000 1e>;
    "main-url" = "file://localhost/Volumes/netboot/Lion.nbi/Library.dmg";
    "mount-nobrowse" = 1;
    operation = DIHelperAttach;
    quiet = 0;
    "shadow-url" = "file://localhost/private/var/netboot/Library-Shadow";
    "skip-verify" = 1;
    verbose = 0;
}
2012-11-27 12:02:23.056 hdiutil[23401:707] [DIHelperProxy alloc]
2012-11-27 12:02:23.056 hdiutil[23401:707] [DIHelperProxy alloc] returning self 0x7fa39b00d690, retainCount 1
2012-11-27 12:02:23.057 hdiutil[23401:707] DIHLDiskImageAttach: running DIHelperProxy
2012-11-27 12:02:23.057 hdiutil[23401:707] [DIHelperProxy performOperationReturning] entry
2012-11-27 12:02:23.057 hdiutil[23401:707] [DIHelperProxy performOperationReturning] detaching thread
2012-11-27 12:02:23.058 hdiutil[23401:2803] [DIHelperProxy workerThread] entry
2012-11-27 12:02:23.058 hdiutil[23401:2803] [DIHelperProxy workerThread] setting up server
2012-11-27 12:02:23.059 hdiutil[23401:2803] [DIHelperProxy threadSetupServer] entry
2012-11-27 12:02:23.059 hdiutil[23401:2803] [DIHelperProxy threadSetupServer] setting up _headerConnection
2012-11-27 12:02:23.060 hdiutil[23401:2803] [DIHelperProxy threadSetupServer] setting up _headerConnection rootObject
2012-11-27 12:02:23.060 hdiutil[23401:2803] [DIHelperProxy threadSetupServer] adding NSConnectionDidInitializeNotification notification
2012-11-27 12:02:23.061 hdiutil[23401:2803] [DIHelperProxy threadSetupServer] exiting
2012-11-27 12:02:23.061 hdiutil[23401:2803] [DIHelperProxy workerThread] launching
2012-11-27 12:02:23.061 hdiutil[23401:2803] [DIHelperProxy threadLaunchToolAuthenticated] entry
2012-11-27 12:02:23.063 hdiutil[23401:2803] launching helper tool at "/System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper".
2012-11-27 12:02:23.063 hdiutil[23401:2803] [DIHelperProxy threadLaunchToolAuthenticated] adding NSTaskDidTerminateNotification notification
2012-11-27 12:02:23.063 hdiutil[23401:2803] [DIHelperProxy thread LaunchToolAuthenticated] launching
2012-11-27 12:02:23.065 hdiutil[23401:2803] [DIHelperProxy threadLaunchToolAuthenticated] exiting
2012-11-27 12:02:23.065 hdiutil[23401:2803] [DIHelperProxy workerThread] running runloop
2012-11-27 12:02:23.081 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] entry
2012-11-27 12:02:23.081 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] adding new NSConnectionDidDieNotification notification
2012-11-27 12:02:23.081 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] removing old NSConnectionDidDieNotification notification
2012-11-27 12:02:23.082 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] removing old connection rootObject
2012-11-27 12:02:23.082 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] invalidating old connection
2012-11-27 12:02:23.083 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] releasing old connection
2012-11-27 12:02:23.083 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] and replacing with new connection
2012-11-27 12:02:23.083 hdiutil[23401:2803] [DIHelperProxy helperConnectionInitialized] exit
2012-11-27 12:02:23.085 hdiutil[23401:2803] [DIHelperProxy connectToFramework] entry, helper 0x7fa39b016940
2012-11-27 12:02:23.085 hdiutil[23401:2803] [DIHelperProxy connectToFramework] exit
2012-11-27 12:02:23.186 hdiutil[23401:2803] [DIHelperProxy sendOperationToHelper] entry
2012-11-27 12:02:23.187 hdiutil[23401:2803] [DIHelperProxy sendOperationToHelper] starting operation with helper
2012-11-27 12:02:23.190 hdiutil[23401:2803] [DIHelperProxy sendOperationToHelper] exit
2012-11-27 12:02:23.194 hdiutil[23401:2803] [DIHelperProxy frameworkCallbackWithDictionary] entry
status proc called: initialize
Initializing…
myStatusProc: returning 0 
2012-11-27 12:02:23.199 hdiutil[23401:2803] [DIHelperProxy frameworkCallbackWithDictionary] exit
2012-11-27 12:02:23.201 diskimages-helper[23407:2503] updateImageAndDriveDictionaries: before update _imageOptions: {
    "enable-keychain" = 1;
    writeable = 0;
}
2012-11-27 12:02:23.201 diskimages-helper[23407:2503] updateImageAndDriveDictionaries: _imageOptions: {
    "enable-keychain" = 1;
    "legacy-disabled" = 1;
    writeable = 0;
}
2012-11-27 12:02:23.202 diskimages-helper[23407:2503] _driveOptions: {
    "auto-fsck" = 0;
    autodiskmount = 1;
    removable = 0;
    "unmount-timeout" = 0;
}
2012-11-27 12:02:23.202 diskimages-helper[23407:2503] DIHelperAttach: performOperation: initializing framework
2012-11-27 12:02:23.202 diskimages-helper[23407:2503] {
    agent = hdiutil;
    "auto-fsck" = 0;
    "auto-fsck-failure-override-type" = callback;
    "auto-open-ro-root" = 0;
    "auto-open-rw-root" = 0;
    "auto-stretch" = 0;
    "bundlebs-checkpointing" = 0;
    "bundlebs-localcloseonflush" = 0;
    "bundlebs-localcloseonidle" = 0;
    "bundlebs-localcloseonsleep" = 0;
    "bundlebs-localfdcount" = 6;
    "bundlebs-remotecloseonflush" = 0;
    "bundlebs-remotecloseonidle" = 0;
    "bundlebs-remotecloseonsleep" = 0;
    "bundlebs-remotefdcount" = 3;
    "burn-apple-supported-devices-only" = 0;
    "burn-no-underrun-protection" = 0;
    "burn-synthesize-content" = 1;
    "bzip2-level" = 0;
    "callback-with-sla" = 1;
    debug = 1;
    "disable-encrypted-images" = 0;
    "disable-kernel-mounting" = 1;
    "disable-owners" = 0;
    "drive-options" = <62706c69 73743030 d0080000 00000000 01010000 00000000 00010000 00000000 00000000 00000000 0009>;
    "enable-owners" = 1;
    "filevault-default-case-sensitive-file-system" = "Case-sensitive Journaled HFS+";
    "filevault-default-encryption-type" = "AES-128";
    "filevault-default-file-system" = "Journaled HFS+";
    "filevault-default-image-type" = SPARSEBUNDLE;
    "filevault-default-partition-type" = SPUD;
    "filevault-default-volume-name" = FileVault;
    "fixed-disk" = 1;
    "force-idme" = 0;
    "hfsplus-stretch-parameters" =     {
        "hfsplus-stretch-allocation-block-size" = 4096;
        "hfsplus-stretch-allocation-file-size" = 8388608;
        "hfsplus-stretch-threshold" = 524288;
    };
    "idle-timeout" = 15;
    "ifd-format" = UDZO;
    "ifd-ignore-io-errors" = 1;
    "ifd-segment-size" = 0;
    "iff-format" = UDZO;
    "iff-fs" = "HFS+";
    "iff-layout" = SPUD;
    "iff-source-owners" = auto;
    "iff-spotlight-indexing" = 0;
    "iff-temp-sparse-band-size" = 20480;
    "iff-temp-use-rw-if-possible" = 1;
    "iff-usehelper" = 1;
    "ignore-bad-checksums" = 0;
    "image-options" = <62706c69 73743030 d101025f 100f6c65 67616379 2d646973 61626c65 6409080b 1d000000 00000001 01000000 00000000 03000000 00000000 00000000 00000000 1e>;
    "main-url" = "file://localhost/Volumes/netboot/Lion.nbi/Library.dmg";
    "mount-attempted" = 1;
    "mount-nobrowse" = 1;
    "mount-point" = "/Volumes/";
    "mount-private" = 0;
    "mount-required" = 1;
    "mount-type" = in;
    "nbi-spotlight-indexing" = 0;
    operation = DIHelperAttach;
    "progress-delay" = 5;
    "pthread-reader-cap" = 4;
    quiet = 0;
    "reauthenticate-upon-wake" = 1;
    "shadow-url" = "file://localhost/private/var/netboot/Library-Shadow";
    "skip-auto-fsck-for-system-images" = 1;
    "skip-idme" = 1;
    "skip-idme-reveal" = 0;
    "skip-idme-trash" = 0;
    "skip-previously-verified" = 1;
    "skip-sla" = 0;
    "skip-verify" = 1;
    "skip-verify-locked" = 0;
    "skip-verify-remote" = 1;
    "sparsebundle-compactonidle" = 0;
    "suppress-uiagent" = 1;
    "unmount-timeout" = 0;
    "use-compressed-xml" = 0;
    "use-keychain" = 1;
    verbose = 0;
    "zlib-level" = 1;
}
DILoadDriver: checking for disk image driver
DILoadDriver: DI_kextExists() returned 0x00000000 (0)
DIIsInitialized: returning NO
2012-11-27 12:02:23.206 diskimages-helper[23407:2503] -checkForPreviouslyAttachedImage: entry
2012-11-27 12:02:23.206 diskimages-helper[23407:2503] imageURL file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
2012-11-27 12:02:23.206 diskimages-helper[23407:2503] shadowURL file://localhost/private/var/netboot/Library-Shadow
2012-11-27 12:02:23.207 diskimages-helper[23407:2503] sectionStart (null) sectionLength (null)
2012-11-27 12:02:23.207 diskimages-helper[23407:2503] checkForPreviouslyAttachedImage: setting legacy-disabled to 1
DIIsInitialized: returning YES
DIBackingStoreNewWithCFURL: entry with
file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
skip-permissions-check: true
legacy-disabled: true
DIBackingStoreInstantiatorProbe: entry
file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
skip-permissions-check: true
legacy-disabled: true
DIBackingStoreInstantiatorProbe: probing interface 0 CBSDBackingStore
CBSDBackingStore::newProbe score 100 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 1 CBundleBackingStore
CBundleBackingStore::newProbe score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 2 CRAMBackingStore
CRAMBackingStore::probe: scheme "file": not ram: or ramdisk: scheme.
CRAMBackingStore::probe: score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 3 CCarbonBackingStore
CCarbonBackingStore::newProbe: setting initial rval to +100
CCarbonBackingStore::newProbe score 100 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 4 CDevBackingStore
CDevBackingStore::newProbe: not /dev/disk or /dev/rdisk (/Volumes/netboot/Lion.nbi/Library.dmg).CDevBackingStore::newProbe score -1000 for 
DIBackingStoreInstantiatorProbe: probing interface 5 CCURLBackingStore
CCURLBackingStore::probe: scheme is: file
CCURLBackingStore::probe: not recognized URL scheme.
CCURLBackingStore::probe: score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 6 CVectoredBackingStore
CVectoredBackingStore::newProbe not "vectored" scheme.
CVectoredBackingStore::newProbe score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: selecting CBSDBackingStore
DIBackingStoreNewWithCFURL: CBSDBackingStore
CBSDBackingStore::setNoFollow: setting _noFollow to 0
DIBackingStoreNewWithCFURL: instantiator returned 0
DIBackingStoreNewWithCFURL: returning 0
2012-11-27 12:02:23.208 diskimages-helper[23407:2503] -checkForPreviouslyAttachedImage: resolving file://localhost/Volumes/netboot/Lion.nbi/Library.dmg returned 0
DIIsInitialized: returning YES
DIBackingStoreNewWithCFURL: entry with
file://localhost/private/var/netboot/Library-Shadow
skip-permissions-check: true
DIBackingStoreInstantiatorProbe: entry
file://localhost/private/var/netboot/Library-Shadow
skip-permissions-check: true
DIBackingStoreInstantiatorProbe: probing interface 0 CBSDBackingStore
CBSDBackingStore::newProbe score 1 for file://localhost/private/var/netboot/Library-Shadow
DIBackingStoreInstantiatorProbe: probing interface 1 CBundleBackingStore
CBundleBackingStore::newProbe score -1000 for file://localhost/private/var/netboot/Library-Shadow
DIBackingStoreInstantiatorProbe: probing interface 2 CRAMBackingStore
CRAMBackingStore::probe: scheme "file": not ram: or ramdisk: scheme.
CRAMBackingStore::probe: score -1000 for file://localhost/private/var/netboot/Library-Shadow
DIBackingStoreInstantiatorProbe: probing interface 3 CCarbonBackingStore
CCarbonBackingStore::newProbe stat() failed.  No such file or directory.
CCarbonBackingStore::newProbe score -1000 for file://localhost/private/var/netboot/Library-Shadow
DIBackingStoreInstantiatorProbe: probing interface 4 CDevBackingStore
CDevBackingStore::newProbe: not /dev/disk or /dev/rdisk (/private/var/netboot/Library-Shadow).CDevBackingStore::newProbe score -1000 for 
DIBackingStoreInstantiatorProbe: probing interface 5 CCURLBackingStore
CCURLBackingStore::probe: scheme is: file
CCURLBackingStore::probe: not recognized URL scheme.
CCURLBackingStore::probe: score -1000 for file://localhost/private/var/netboot/Library-Shadow
DIBackingStoreInstantiatorProbe: probing interface 6 CVectoredBackingStore
CVectoredBackingStore::newProbe not "vectored" scheme.
CVectoredBackingStore::newProbe score -1000 for file://localhost/private/var/netboot/Library-Shadow
DIBackingStoreInstantiatorProbe: selecting CBSDBackingStore
DIBackingStoreNewWithCFURL: CBSDBackingStore
DIBackingStoreNewWithCFURL: instantiator returned 2
DIBackingStoreNewWithCFURL: returning 2
DIResolveURLToBackingStore: unable to resolve to any backing store class. 2. 
2012-11-27 12:02:23.208 diskimages-helper[23407:2503] -checkForPreviouslyAttachedImage: resolving shadow file://localhost/private/var/netboot/Library-Shadow returned 2
2012-11-27 12:02:23.208 diskimages-helper[23407:2503] DIHelperAttach: performOperation: resolving disk image
DIIsInitialized: returning YES
DIIsInitialized: returning YES
DIBackingStoreNewWithCFURL: entry with
file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
legacy-disabled: true
writeable: false
enable-keychain: true
image-path: /Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: entry
file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
legacy-disabled: true
writeable: false
enable-keychain: true
image-path: /Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 0 CBSDBackingStore
CBSDBackingStore::newProbe score 100 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 1 CBundleBackingStore
CBundleBackingStore::newProbe score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 2 CRAMBackingStore
CRAMBackingStore::probe: scheme "file": not ram: or ramdisk: scheme.
CRAMBackingStore::probe: score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 3 CCarbonBackingStore
CCarbonBackingStore::newProbe: setting initial rval to +100
CCarbonBackingStore::newProbe score 100 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 4 CDevBackingStore
CDevBackingStore::newProbe: not /dev/disk or /dev/rdisk (/Volumes/netboot/Lion.nbi/Library.dmg).CDevBackingStore::newProbe score -1000 for 
DIBackingStoreInstantiatorProbe: probing interface 5 CCURLBackingStore
CCURLBackingStore::probe: scheme is: file
CCURLBackingStore::probe: not recognized URL scheme.
CCURLBackingStore::probe: score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: probing interface 6 CVectoredBackingStore
CVectoredBackingStore::newProbe not "vectored" scheme.
CVectoredBackingStore::newProbe score -1000 for file://localhost/Volumes/netboot/Lion.nbi/Library.dmg
DIBackingStoreInstantiatorProbe: selecting CBSDBackingStore
DIBackingStoreNewWithCFURL: CBSDBackingStore
CBSDBackingStore::setPermission: opening /Volumes/netboot/Lion.nbi/Library.dmg
CBSDBackingStore::OpenLockFriendly: mapping flags 0x00000000 -> 0x00000014 (locks are MANDATORY)
CBSDBackingStore:OpenLockFriendly: could not open with lock 30
DIBackingStoreNewWithCFURL: instantiator returned 30
DIBackingStoreNewWithCFURL: returning 30
DIResolveURLToBackingStore: unable to resolve to any backing store class. 30. 
DIResolveURLToDiskImage: resolving backing store/file encoding failed. 30. 
2012-11-27 12:02:23.211 hdiutil[23401:2803] [DIHelperProxy frameworkCallbackWithDictionary] entry
status proc called: attach
Attaching…
Error 30 (Read-only file system).
myStatusProc: returning 0 
2012-11-27 12:02:23.227 hdiutil[23401:2803] [DIHelperProxy frameworkCallbackWithDictionary] exit
2012-11-27 12:02:23.228 hdiutil[23401:2803] [DIHelperProxy frameworkCallbackWithDictionary] entry
status proc called: cleanup
Finishing…
myStatusProc: returning 0 
2012-11-27 12:02:23.228 hdiutil[23401:2803] [DIHelperProxy frameworkCallbackWithDictionary] exit
2012-11-27 12:02:23.229 diskimages-helper[23407:2503] DIHelperAttach performOperation: returning 30
2012-11-27 12:02:23.229 diskimages-helper[23407:2503] -decrementBackgroundThreadCount: _backgroundThreadCount is now 0.
2012-11-27 12:02:23.229 diskimages-helper[23407:303] DIHelper _report_results: reporting {
    payload =     {
    };
    "result-code" = 30;
}
2012-11-27 12:02:23.230 hdiutil[23401:2803] reportResultsToFramework: proxy has finished operation
2012-11-27 12:02:23.230 hdiutil[23401:2803] reportResultsToFramework: results are: {
    payload =     {
    };
    "result-code" = 30;
}
2012-11-27 12:02:23.230 hdiutil[23401:2803] reportResultsToFramework: _threadResultsError is 30
2012-11-27 12:02:23.231 hdiutil[23401:2803] reportResultsToFramework: disconnecting from helper.
2012-11-27 12:02:23.231 diskimages-helper[23407:303] -setCanTerminate: main thread can exit
2012-11-27 12:02:23.332 hdiutil[23401:2803] [DIHelperProxy disconnectFromHelper] entry
2012-11-27 12:02:23.333 hdiutil[23401:2803] disconnectFromHelper: removing observers
2012-11-27 12:02:23.333 hdiutil[23401:2803] disconnectFromHelper: terminating proxy
2012-11-27 12:02:23.334 diskimages-helper[23407:303] DIHelper: terminateHelper: entry.
2012-11-27 12:02:23.334 hdiutil[23401:2803] disconnectFromHelper: terminated proxy
2012-11-27 12:02:23.335 hdiutil[23401:2803] [DIHelperProxy disconnectFromHelper] releasing helper
2012-11-27 12:02:23.335 hdiutil[23401:2803] [DIHelperProxy disconnectFromHelper] exit
2012-11-27 12:02:23.435 diskimages-helper[23407:303] [DIHelper frameworkConnectionDied] entry
2012-11-27 12:02:23.435 diskimages-helper[23407:303] [DIHelper frameworkConnectionDied] releasing connection
2012-11-27 12:02:23.435 diskimages-helper[23407:303] [DIHelper frameworkConnectionDied] releasing frameworkProxy
2012-11-27 12:02:23.435 diskimages-helper[23407:303] -DIHelperAgentMaster terminateUIAgentConnection.
2012-11-27 12:02:23.435 diskimages-helper[23407:303] [DIHelper frameworkConnectionDied] marking _frameworkDisconnected
2012-11-27 12:02:23.435 diskimages-helper[23407:303] [DIHelper frameworkConnectionDied] exiting
2012-11-27 12:02:24.232 hdiutil[23401:2803] [DIHelperProxy workerThread] removing NSConnectionDidDieNotification observers
2012-11-27 12:02:24.233 hdiutil[23401:2803] [DIHelperProxy workerThread] removing NSConnectionDidInitializeNotification observers
2012-11-27 12:02:24.234 hdiutil[23401:2803] [DIHelperProxy workerThread] removing NSTaskDidTerminateNotification observers
2012-11-27 12:02:24.234 hdiutil[23401:2803] [DIHelperProxy threadRunRunLoop] invalidating connection
2012-11-27 12:02:24.235 diskimages-helper[23407:303] DIHelper dealloc.
2012-11-27 12:02:24.234 hdiutil[23401:2803] [DIHelperProxy threadRunRunLoop] releasing connection
2012-11-27 12:02:24.235 diskimages-helper[23407:303] -DIHelperAgentMaster terminateUIAgentConnection.
2012-11-27 12:02:24.235 hdiutil[23401:2803] [DIHelperProxy workerThread] after running runloop
2012-11-27 12:02:24.235 diskimages-helper[23407:303] helper: child_after_exec returning 0
2012-11-27 12:02:24.235 hdiutil[23401:2803] [DIHelperProxy workerThread] waiting for task to terminate to avoid zombies
2012-11-27 12:02:24.236 hdiutil[23401:2803] [DIHelperProxy workerThread] releasing task
2012-11-27 12:02:24.236 hdiutil[23401:2803] [DIHelperProxy workerThread] exiting
2012-11-27 12:02:24.236 hdiutil[23401:707] [DIHelperProxy performOperationReturning] returning 30
2012-11-27 12:02:24.237 hdiutil[23401:707] DIHLDiskImageAttach: DIHelperProxy returned 30
2012-11-27 12:02:24.237 hdiutil[23401:707] [DIHelperProxy dealloc]
DIHLDiskImageAttach() returned 30
hdiutil: attach failed - Read-only file system
kyle:~ root# 

1
我没有要测试的NFS共享,但是我会尝试安静的系统并运行fs_usage以查看是否可以捕获文件系统进行写入调用 - 可能会提交Apple的错误。看起来你应该能够阅读只读DMG - 但也许有一些更深层次的技术原因导致它失败,操作系统需要更好的错误信息告诉我们为什么......
bmike

好主意@bmike!此外,我hdiutil-debug开关运行,我可以在这里发布这些日志
Josh

确实 - 用您发现的任何内容做出答案,我们可以合作 - 报告错误或编辑答案,因为我们选择了“为什么”。
bmike

哪个操作系统在NFS服务器上运行?rpcinfo -p服务器上的输出是什么?mountMac上的输出是什么?您还可以在/etc/exportsNFS服务器上添加相关的问题吗?
jaume

1
我已经设置了一个NFS服务器(Ubuntu 12.04),它带有我在Mac上安装的只读导出(OS X 10.8.2),我无法重现你的问题(我测试了所有dmg格式:readonly,压缩,加密等)...你能否将hdiutil -debug我要求的输出和信息添加到你的问题中?
jaume

Answers:


11

自2012年11月以来,我一直对这个问题感兴趣,甚至建立了一个FreeNAS VM来重现这个问题。

我最终放弃了,但由于问题已经复苏,我将分享我当时和最后几个小时发现的内容(幸运的是我没有删除VM)以及我认为这个问题的原因是什么。我也找到了一个解决方法。

我的设置

首先,这是我的测试设置:

  • OS X 10.8.2(对不起,周围没有10.7.5)。

  • FreeNAS(FreeBSD 8.2-RELEASE-p1)

    在此输入图像描述

    (OP的版本是FreeBSD 8.2-RELEASE-p7 - 我找不到相同的版本。)

  • NAS文件系统/mnt/raid

    在此输入图像描述

  • 用户名为netboot

    在此输入图像描述

  • AFP文件系统(/mnt/raid/netboot)导出为netboot

    在此输入图像描述

    (请注意,它配置为只读)。

  • NFS文件系统(与AFP文件系统相同的路径,以匹配OP的配置:) /mnt/raid/netboot

    在此输入图像描述

AFP工作,NFS没有

netboot使用Finder 将AFP只读文件系统作为用户安装K

在此输入图像描述

并安装了一个没有任何问题的DMG图像文件:

$ sudo rm /private/var/netboot/Library-Shadow
$ sudo /usr/bin/hdiutil attach /Volumes/netboot/p7zip-9.04-0.i386.dmg -notremovable -shadow /private/var/netboot/Library-Shadow -owners on -noverify -noautofsck -nobrowse
Password:
/dev/disk3              Apple_partition_scheme          
/dev/disk3s1            Apple_partition_map             
/dev/disk3s2            Apple_HFS                       /Volumes/p7zip.pkg

然后我卸载它并安装了只读的NFS文件系统(我也使用过K)并且无法安装DMG映像文件。

我认为问题记录在这里:

CBSDBackingStore::setPermission: opening /Volumes/netboot/Lion.nbi/Library.dmg
CBSDBackingStore::OpenLockFriendly: mapping flags 0x00000000 -> 0x00000014 (locks are MANDATORY)
CBSDBackingStore:OpenLockFriendly: could not open with lock 30

错误30表示(见man 2 intro):

30 EROFS只读文件系统。尝试修改文件或目录是在当时只读的文件系统上进行的。

这并不奇怪,它确实是一个只读的文件系统,但......当安装在AFP上时,它有效,为什么?

因为Apple的NFS实现在锁定方面存在一些问题。正如本文在gluster.org上所述:

OS X执行一定数量的文件锁定(有些人会说,不必要地),并且始终对NFS服务器上的锁定配置非常敏感。如此,如果您在大型企业中随机选择NFS服务器,那么真正的成功是不太可能的。

在我的设置中,NFS服务器(即FreeNAS VM)突然没有响应(来自我的Mac /var/log/system.log):

Mar 15 15:35:04 avallone.local rpc.lockd[8119]: Lockd got unexpected signal 20
Mar 15 15:35:04 avallone com.apple.launchd[1] (com.apple.lockd[8119]): Exited with code: 1
Mar 15 15:35:04 avallone com.apple.launchd[1] (com.apple.lockd): Throttling respawn: Will start in 10 seconds
(...)
Mar 15 15:35:07 avallone com.apple.launchd[1] (com.apple.statd[8121]): Exited with code: 1
Mar 15 15:35:07 avallone com.apple.launchd[1] (com.apple.statd): Throttling respawn: Will start in 10 seconds
Mar 15 15:35:13 avallone kernel[0]: nfs server 172.16.54.186:/mnt/raid/netboot: lockd not responding
Mar 15 15:35:13 avallone.local KernelEventAgent[72]: tid 00000000 received event(s) VQ_NOTRESP (1)
Mar 15 15:35:13 avallone.local KernelEventAgent[72]: tid 00000000 type 'nfs', mounted on '/Volumes/netboot', from '172.16.54.186:/mnt/raid/netboot', not responding
(...)
Mar 15 15:35:34 avallone.local KernelEventAgent[72]: tid 00000000 unmounting 1 filesystems

输出sudo /usr/bin/hdiutil attach -debug /Volumes/netboot/p7zip-9.04-0.i386.dmg -notremovable -shadow /private/var/netboot/Library-Shadow -owners on -noverify -noautofsck -nobrowse是:

CBSDBackingStore::setPermission: opening /Volumes/netboot/p7zip-9.04-0.i386.dmg
CBSDBackingStore::OpenLockFriendly: mapping flags 0x00000000 -> 0x00000014 (locks are MANDATORY)
CBSDBackingStore:OpenLockFriendly: could not open with lock 5

错误5表示(再次man 2 intro):

5 EIO输入/输出错误。发生了一些物理输入或输出错误。在对同一文件描述符进行后续操作之前,不会报告此错误,并且可能由于任何后续错误而丢失(重写)。

这根本不足为奇,NFS文件系统已经消失了。

解决方法

解决方法(在OS X 10.8上测试)是使用选项挂载NFS nolocks,locallocks。正如已经提到的gluster.org上的帖子所解释的那样:

幸运的是,有一个修复:只需关闭网络锁定。您可以通过在“磁盘工具NFS安装”UI的高级选项字段中添加“nolocks,locallocks”选项来完成此操作,但如果您执行了很多操作,这会很痛苦,并且对/ net没有任何帮助。您可以编辑/ etc / auto_master将这些选项添加到/ net条目,但它不会影响其他安装 - 但我建议删除auto_master中的hidefromfinder选项。如果要修复每个自动挂载,请编辑/etc/autofs.conf并搜索以AUTOMOUNTD_MNTOPTS =开头的行。这些选项适用于每个安装。重新启动后添加nolocks,locallocks和您的世界会更快更快乐。

我手动安装172.16.54.186:/mnt/raid/netboot,它完美无缺:

$ sudo rm /private/var/netboot/Library-Shadow
$ sudo mount -o nolocks,locallocks,ro 172.16.54.186:/mnt/raid/netboot /tmp/mnt
$ sudo /usr/bin/hdiutil attach /tmp/mnt/p7zip-9.04-0.i386.dmg -notremovable -shadow /private/var/netboot/Library-Shadow -owners on -noverify -noautofsck -nobrowse
/dev/disk6              Apple_partition_scheme          
/dev/disk6s1            Apple_partition_map             
/dev/disk6s2            Apple_HFS                       /Volumes/p7zip.pkg

我也/etc/auto_master像这样编辑:

+auto_master # Use directory service
#/net             -hosts    -nobrowse,hidefromfinder,nosuid
/net              -hosts    -nosuid,nolocks,locallocks
/home             auto_home -nobrowse,hidefromfinder
/Network/Servers  -fstab
/-                -static

停止和启动automountdautofsd

$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.automountd.plist 
$ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.autofsd.plist 
$ sudo launchctl load /System/Library/LaunchDaemons/com.apple.autofsd.plist 
$ sudo launchctl load /System/Library/LaunchDaemons/com.apple.automountd.plist 

像魅力一样工作:

$ cd /net/172.16.54.186/mnt/raid/netboot
$ ls 
Network Trash Folder  Temporary Items  p7zip-9.04-0.i386.dmg
$ sudo rm /private/var/netboot/Library-Shadow
$ sudo /usr/bin/hdiutil attach p7zip-9.04-0.i386.dmg -notremovable -shadow /private/var/netboot/Library-Shadow -owners on -noverify -noautofsck -nobrowse
/dev/disk7              Apple_partition_scheme          
/dev/disk7s1            Apple_partition_map             
/dev/disk7s2            Apple_HFS                       /Volumes/p7zip.pkg

真棒,多好读。
gosmond 2013年

哇太棒了,谢谢!我将在周末对此进行测试,这可能会解决我的问题!
Josh

谢谢jaume,这就像一个魅力!不幸的是,我已经找到了一个替代方案,不再需要使用影子文件安装这个相同的DMG,但是nolocks,locallocks正在帮助其他只读NFS共享NFS与DMG文件共享,所以谢谢!
Josh

感谢您的反馈,我很高兴您的环境中的解决方法。虽然你不再需要它,但很高兴知道为什么某些东西不起作用,不是吗?
jaume 2013年

当然,如果我将来再次需要,我现在知道需要改变什么!(之前的目标是将/Library我们的NetBoot映像放入RAID阵列。我们不再需要这个,因为我们购买了新的Mac Pro服务器)
Josh

-1

hdiutil attach -readonly ...

对于存储在只读文件系统上的图像,我认为-readonly应该在附件时使用。

(法新社案例可能例外。)


考虑到@Josh的投票和评论:我误解-shadow了手册页的部分hdiutil

...允许读取/写入只读图像...

- 我想象-shadow可以覆盖-readonly


不,你误解了。我想将只读图像作为带有阴影文件的读写卷附加。
Josh 2013年

1
关于你的编辑,不,使用两者-readonly并将-shadow从影子文件中读取,但将图像以只读方式挂载。因此,例如,它允许您在不更新该影子文件的情况下读取对影子文件所做的更改。问题是jaume发现的NFS锁定。
Josh 2013年

来自@Josh的非常巧妙的解释 - 谢谢!我会留下这个答案,以便其他读者不会犯我一样的错误。
Graham Perrin 2013年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.