简体   繁体   English

在OS X上使用hdiutil分离卷时出错

[英]Error when detaching volume using hdiutil on OS X

Ive got a program that runs on Mac OS 10.5.8. 我有一个在Mac OS 10.5.8上运行的程序。 The program runs a continuous cycle where it mounts an image, installs a browser plugin and unmounts the image again. 该程序运行一个连续循环,在其中安装映像,安装浏览器插件并再次卸载映像。 If I leave this program running I eventually end up in a situation where I get the following error "fork: resource temporarily unavailable". 如果我让这个程序继续运行,我最终会遇到以下错误:“fork:resource暂时不可用”。 In the activity monitor I can see that several hundreds of processes called diskimages-helper are running. 在活动监视器中,我可以看到数百个名为diskimages-helper的进程正在运行。 Does anyone know why this happens and how I can avoid it? 有谁知道为什么会这样,我怎么能避免它? Below are the commands I use during one cycle of the program. 以下是我在程序的一个循环中使用的命令。

# First I remove the plugin
rm -rf "/Library/Internet Plug-Ins/my.plugin"

# If the mount exists I unmount it
hdiutil unmount [mount] -force

# If that doesnt work I detach the device
hdiutil detach [device] -force

# Then I mount the image
hdiutil mount [image]

# I install the plugin
installer -package [package] -target /

# Unmount
hdiutil unmount [mount] -force

# And if necessary detach
hdiutil detach [device] -force

You need to always detach the disk image -- unmounting it unmounts the filesystem, but leaves disk image attached to a /dev/disk* entry, with a diskimages-helper process running to handle it. 您需要始终分离磁盘映像 - 卸载它卸载文件系统,但将磁盘映像附加到/ dev / disk *条目,并运行diskimages-helper进程来处理它。 Note that hdiutil detach will take care of unmounting the volume for you (provided Disk Arbitration is running), so you can just skip the unmount step. 请注意, hdiutil detach将负责为您卸载卷(如果磁盘仲裁正在运行),因此您可以跳过卸载步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM