卸载网络卷?
如何卸载网络卷?
NSWorkspace
认为它们既不可移动也不不可安装。 unmountAndEjectDeviceAtPath: @"/Volumes/有问题的网络卷"
不会导致任何情况发生。可能有一些简单的方法可以做到这一点,就在我眼皮子底下,但我找不到它。
我不想诉诸于制作一个 Applescript 告诉 Finder 弹出网络卷并从 Cocoa 调用它,因为这实在是太恶心了。
(顺便说一句,我的开发平台是 Tiger)
How do I unmount a network volume?
NSWorkspace
thinks they're neither removable nor unmountable. unmountAndEjectDeviceAtPath: @"/Volumes/the network volume in question"
causes nothing whatsoever to happen. There's probably some easy way to do this, sitting right under my nose, but I can't find it.
I don't want to resort to making an Applescript telling the Finder to Eject network volumes and calling it from Cocoa because that's just incredibly icky.
(my dev platform is Tiger, by the way)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正在调用
unmount(2 )
公平游戏? (多么奇怪,大多数 Unix 系统将系统调用命名为umount()
,而不是unmount()
,并且联机帮助页经常将其称为umount()
尽管名称和概要部分相当清楚地使用了unmount()
。)挂载是否被其他东西使用?检查
lsof(1)
或fuser(1)
输出以查看当前打开该文件系统的进程(如果有)。 (也许在卸载调用之前添加一个简单的chdir("/");
就可以了?)Is calling
unmount(2)
fair-game? (How odd, most Unix systems name the system callumount()
, notunmount()
, and the manpage frequently calls itumount()
despite the name and Synopsis sections fairly clearly usingunmount()
.)Is the mount in use by anything else? Check
lsof(1)
orfuser(1)
output to see which processes, if any, have that filesystem currently open. (Maybe adding a simplechdir("/");
just before your unmount call would do it?)您还可以使用 diskutil,它可以处理比 unmount() 更多的情况:
请注意挂载点周围的双引号,很可能类似于
/Volumes/Untitled
,但也可能类似于/Volumes/NO姓名
You can also use diskutil which handles more situations than unmount():
Note the double quotes around the mount point, most likely something like
/Volumes/Untitled
, but also something like/Volumes/NO NAME