强制卸载 NFS 挂载目录
我的 Linux 机器上有一个挂载 NFS 的目录。 我尝试强制卸载,但似乎不起作用:
$ umount -f /mnt/data
$ umount2: Device or resource busy
$ umount: /mnt/data: device is busy
如果我输入“mount
”,则该目录似乎不再安装,但如果我输入“< code>ls /mnt/data”,如果我尝试删除挂载点,我会得到:
$ rmdir /mnt/data
rmdir: /mnt/data: Device or resource busy
除了重新启动机器之外,我还能做些什么吗?
I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work:
$ umount -f /mnt/data
$ umount2: Device or resource busy
$ umount: /mnt/data: device is busy
If I type "mount
", it appears that the directory is no longer mounted, but it hangs if I do "ls /mnt/data
", and if I try to remove the mountpoint, I get:
$ rmdir /mnt/data
rmdir: /mnt/data: Device or resource busy
Is there anything I can do other than reboot the machine?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试运行
这应该列出正在访问 /mnt/data 的所有进程,这些进程将阻止其卸载。
Try running
That should list any process that is accessing /mnt/data that would prevent it from being unmounted.
我也遇到了同样的问题,并且
两者都不
umount /path -f
,umount.nfs /path -f 都不是,
两者都不
fuser -km /path
,终于成功了
,我找到了一个简单的解决方案>。<
sudo /etc/init.d/nfs-common restart
,然后让我们执行简单的umount
;-)I had the same problem, and
neither
umount /path -f
,neither
umount.nfs /path -f
,neither
fuser -km /path
,works
finally I found a simple solution >.<
sudo /etc/init.d/nfs-common restart
, then lets do the simpleumount
;-)如果 NFS 服务器消失并且您无法使其重新联机,我使用的一个技巧是使用 NFS 服务器的 IP(在本例中为 192.0.2.55)向接口添加别名。
Linux 的
命令大致如下:
其中 192.0.2.55 是消失的 NFS 服务器的 IP。 然后您应该能够 ping 该地址,并且还应该能够卸载文件系统(使用 unmount -f)。 然后,您应该销毁别名接口,以便您不再使用以下命令将旧 NFS 服务器的流量路由给您自己:
FreeBSD 和类似的操作系统
该命令类似于:
然后删除它:
man ifconfig(8) 了解更多!
If the NFS server disappeared and you can't get it back online, one trick that I use is to add an alias to the interface with the IP of the NFS server (in this example, 192.0.2.55).
Linux
The command for that is something roughly like:
Where 192.0.2.55 is the IP of the NFS server that went away. You should then be able to ping the address, and you should also be able to unmount the filesystem (use unmount -f). You should then destroy the aliased interface so you no longer route traffic to the old NFS server to yourself with:
FreeBSD and similar operating systems
The command would be something like:
And then to remove it:
man ifconfig(8) for more!
您的 NFS 服务器消失了。
理想情况下,您最好的选择是 NFS 服务器恢复。
如果没有,“umount -f”应该可以解决问题。
它并不总是有效,但通常会有效。
如果您碰巧知道哪些进程正在使用 NFS 文件系统,
您可以尝试终止这些进程,然后卸载可能会起作用。
最后,我猜你需要重新启动。
另外,请勿软安装 NFS 驱动器。 您使用硬安装来保证
他们工作了。 如果您正在进行写入操作,这是必要的。
Your NFS server disappeared.
Ideally your best bet is if the NFS server comes back.
If not, the "umount -f" should have done the trick.
It doesn't ALWAYS work, but it often will.
If you happen to know what processes are USING the NFS filesystem,
you could try killing those processes and then maybe an unmount would work.
Finally, I'd guess you need to reboot.
Also, DON'T soft-mount your NFS drives. You use hard-mounts to guarantee
that they worked. That's necessary if you're doing writes.
在这里找不到有效的答案; 但在 Linux 上,你可以运行“umount.nfs4 /volume -f”,它肯定会卸载它。
Couldn't find a working answer here; but on linux you can run "umount.nfs4 /volume -f" and it definitely unmounts it.
您可以尝试延迟卸载:
You might try a lazy unmount: