gpt4 book ai didi

macos - hdiutil 附加/分离/将结果转换为 "resource temporarily unavailable"

转载 作者:行者123 更新时间:2023-12-05 09:17:20 32 4
gpt4 key购买 nike

从 MacOS 10.13 开始,我遇到了以下问题。

  1. /usr/bin/hdiutil attach "target/MyDrive-tmp.dmg"-mountroot/tmp
/dev/disk3              GUID_partition_scheme           
/dev/disk3s1 Apple_APFS
/dev/disk4 EF57347C-0000-11AA-AA11-0030654
/dev/disk4s1 41504653-0000-11AA-AA11-0030654 /private/tmp/MyDrive
  1. /usr/bin/hdiutil detach -force -debug "/tmp/MyDrive"diskutil eject "/tmp/MyDrive"
process_detach: entry with "/tmp/MyDrive"
util_verify_dev_entry: entry with "disk4s1".
process_detach_deventry: about to unmount_and_eject disk4s1
unmount_and_eject(disk4s1)
LetDIDriverSettleDown: calling IOServiceWaitQuiet...
DI_kextWaitQuiet: about to call IOServiceWaitQuiet...
DI_kextWaitQuiet: IOServiceWaitQuiet took 0.000005 seconds
LetDiskImageDriverSettleDown: wait took 0.000066 seconds
_unmountCallback: disk4
"disk4" unmounted.
"disk4" ejected.
  1. /usr/bin/hdiutil convert "target/MyDrive-tmp.dmg"-format UDZO -o "target/MyDrive.dmg"-debug
DIIsInitialized: returning YES
DIIsInitialized: returning YES
DIBackingStoreNewWithCFURL: entry with
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
writeable: false
DIBackingStoreInstantiatorProbe: entry
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
writeable: false
DIBackingStoreInstantiatorProbe: probing interface 0 CBSDBackingStore
CBSDBackingStore::newProbe score 100 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 0, score 100, CBSDBackingStore
DIBackingStoreInstantiatorProbe: probing interface 1 CBundleBackingStore
CBundleBackingStore::newProbe score -1000 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 1, score -1000,
CBundleBackingStore
DIBackingStoreInstantiatorProbe: probing interface 2 CRAMBackingStore
CRAMBackingStore::probe: scheme "file": not ram: or ramdisk: scheme.
CRAMBackingStore::probe: score -1000 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 2, score -1000, CRAMBackingStore
DIBackingStoreInstantiatorProbe: probing interface 3 CCarbonBackingStore
CCarbonBackingStore::newProbe: setting initial rval to +100
CCarbonBackingStore::newProbe score 100 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 3, score 100,
CCarbonBackingStore
DIBackingStoreInstantiatorProbe: probing interface 4 CDevBackingStore
CDevBackingStore::newProbe: not /dev/disk or /dev/rdisk (/Users/xxxx/Documents/git/Midi Automator/Midi Automator/target/MyDrive-tmp.dmg).CDevBackingStore::newProbe score -1000 for file:///Users/aguelle/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 4, score -1000, CDevBackingStore
DIBackingStoreInstantiatorProbe: probing interface 5 CCURLBackingStore
CCURLBackingStore::probe: scheme is: file
CCURLBackingStore::probe: not recognized URL scheme.
CCURLBackingStore::probe: score -1000 for
file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 5, score -1000, CCURLBackingStore
DIBackingStoreInstantiatorProbe: probing interface 6 CVectoredBackingStore
CVectoredBackingStore::newProbe not "vectored" scheme.
CVectoredBackingStore::newProbe score -1000 for file:///Users/xxxx/Documents/git/Midi%20Automator/Midi%20Automator/target/MyDrive-tmp.dmg
DIBackingStoreInstantiatorProbe: interface 6, score -1000,
CVectoredBackingStore
DIBackingStoreInstantiatorProbe: selecting CBSDBackingStore
DIBackingStoreNewWithCFURL: CBSDBackingStore
CBSDBackingStore::setPermission: opening /Users/xxxx/Documents/git/Midi
Automator/Midi Automator/target/MIDI Automator-tmp.dmg
CBSDBackingStore::OpenLockFriendly: mapping flags 0x00000000 -> 0x00000014 (locks are MANDATORY)
CBSDBackingStore:OpenLockFriendly: could not open with lock 35
DIBackingStoreNewWithCFURL: instantiator returned 35
DIBackingStoreNewWithCFURL: returning 35
DIResolveURLToBackingStore: unable to resolve to any backing store class. 35.
DIResolveURLToDiskImage: resolving backing store/file encoding failed. 35.
convert: unable to recognize "target/MyDrive-tmp.dmg":
resource temporarily unavailable.hdiutil: convert: result: 35`
  1. /usr/bin/hdiutil attach "target/MyDrive-tmp.dmg"-mountroot/tmp
  2. 在 Finder 中通过鼠标单击弹出 MyDrive
  3. /usr/bin/hdiutil convert "target/MyDrive-tmp.dmg"-format UDZO -o "target/MyDrive.dmg"

-> 结果:转换正常

那么 hdiutil detachdiskutil eject 和从 Finder 中弹出有什么区别呢?

分析:lsof [device] 没有输出,因为设备在 hdiutil detach 至少 mount 后没有留下。

diskutil info "disk4s1"diskutil info/tmp/MyDrive:

Device Identifier:        disk4s1
Device Node: /dev/disk4s1
Whole: No
Part of Whole: disk4
Volume Name: MyDrive
Mounted: Yes
Mount Point: /private/tmp/MyDrive
Partition Type: 41504653-0000-11AA-AA11-00306543ECAC
File System Personality: APFS
Type (Bundle): apfs
Name (User Visible): APFS
Owners: Disabled
OS Can Be Installed: Yes
Media Type: Generic
Protocol: Disk Image
SMART Status: Not Supported
Volume UUID: A3EE0B42-A021-47AA-B424-E494B75049D3
Disk / Partition UUID: A3EE0B42-A021-47AA-B424-E494B75049D3
Disk Size: 212.5 MB (212471808 Bytes) (exactly 414984 512-Byte-Units)
Device Block Size: 4096 Bytes
Volume Total Space: 212.5 MB (212471808 Bytes) (exactly 414984 512-Byte-Units)
Volume Used Space: 184.7 MB (184709120 Bytes) (exactly 360760 512-Byte-Units) (86.9%)
Volume Available Space: 27.8 MB (27762688 Bytes) (exactly 54224 512-Byte-Units) (13.1%)
Allocation Block Size: 4096 Bytes
Read-Only Media: No
Read-Only Volume: No
Device Location: External
Removable Media: Removable
Media Removal: Software-Activated

最佳答案

hdiutil 真正用于处理磁盘镜像,就像您正在做的那样。 finder 中的弹出本质上是 diskutil eject [device]hdutil detach 是“分离磁盘镜像并终止任何关联的进程”(来自手册页)。其中 diskutil 用于“操纵本地磁盘的结构”(来自手册页)。在功能上,hdiutil detachdiskutil eject 相同。它的工作方式取决于磁盘仲裁是否正在运行。

Disk Arbitration 是一个框架,并且在 diskarbitrationd 进程中,它由 launchd 启动并且默认情况下始终处于打开状态。它处理通过 USB、Firewire、Thunderbolt 等连接的磁盘的安装和卸载。

根据 hdutil 的手册页,当磁盘仲裁运行时。 hdutil detach 将使用它来卸载任何文件系统并分离图像。但是,如果 diskarbitrationd 没有运行,那么它会尝试卸载文件系统,并通过对 ioctl 的系统调用直接分离镜像。我不确定 diskutil -eject 是否使用磁盘仲裁框架,但我想说它确实如此。

尝试找出出现该错误的原因可能会很有趣。这通常意味着无法获得独占访问权。您可以尝试使用 lsof [device] 这将显示设备的所有 ope 文件和 PID 以及更多内容,并且这可能会给您提供有关 [EBUSY] 错误原因的线索(资源暂时不可用)。如果您不知道它是什么设备,则可以使用不带参数的 mount 来列出所有设备和安装点。我相信您也可以执行 lsof [mount/point]。 lsof 的手册页是您的 friend ,它很长。

另一个诊断是将 -verbose 选项与 hdiutil 一起使用。它适用于所有动词。因此,/usr/bin/hdiutil -verbose convert "target/MyDrive-tmp.dmg"-format UDZO -o "target/MyDrive.dmg" 可能会提供一些启示。

另一个可能的线索来源是在您尝试导致错误的步骤时打开一个额外的 Terminal.app 窗口,并运行 diskutil activity 命令。此命令持续报告所有磁盘仲裁框架事件。 Ctrl-C 停止进程。

您有一个适合您的解决方法,因此可能调查为什么会出现错误对您来说并不重要或有趣。此外,如果您不想使用 Finder,您始终可以从终端使用 diskutil eject [device]。自从我“升级”到 High Sierra 以来,我注意到很多事情不太对劲,并且基于网络上的博客,Apple 似乎以安全和他们的新文件系统的名义打破了一些东西。我怀疑在这种情况下它是否与安全相关,但如果他们引入了一个错误来改变命令和框架以与 APFS 一起工作,我不会感到惊讶。

关于macos - hdiutil 附加/分离/将结果转换为 "resource temporarily unavailable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48368389/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com