强制卸载 NFS 挂载目录

发布于 2024-07-04 06:09:25 字数 382 浏览 14 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

画尸师 2024-07-11 06:09:26

尝试运行

lsof | grep /mnt/data

这应该列出正在访问 /mnt/data 的所有进程,这些进程将阻止其卸载。

Try running

lsof | grep /mnt/data

That should list any process that is accessing /mnt/data that would prevent it from being unmounted.

迷路的信 2024-07-11 06:09:26

我也遇到了同样的问题,并且
两者都不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 simple umount ;-)

淡墨 2024-07-11 06:09:26

如果 NFS 服务器消失并且您无法使其重新联机,我使用的一个技巧是使用 NFS 服务器的 IP(在本例中为 192.0.2.55)向接口添加别名。

Linux 的

命令大致如下:

ifconfig eth0:fakenfs 192.0.2.55 netmask 255.255.255.255

其中 192.0.2.55 是消失的 NFS 服务器的 IP。 然后您应该能够 ping 该地址,并且还应该能够卸载文件系统(使用 unmount -f)。 然后,您应该销毁别名接口,以便您不再使用以下命令将旧 NFS 服务器的流量路由给您自己:

ifconfig eth0:fakenfs down

FreeBSD 和类似的操作系统

该命令类似于:

ifconfig em0 alias 192.0.2.55 netmask 255.255.255.255

然后删除它:

ifconfig em0 delete 192.0.2.55

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:

ifconfig eth0:fakenfs 192.0.2.55 netmask 255.255.255.255

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:

ifconfig eth0:fakenfs down

FreeBSD and similar operating systems

The command would be something like:

ifconfig em0 alias 192.0.2.55 netmask 255.255.255.255

And then to remove it:

ifconfig em0 delete 192.0.2.55

man ifconfig(8) for more!

攒眉千度 2024-07-11 06:09:26

您的 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.

画▽骨i 2024-07-11 06:09:26

在这里找不到有效的答案; 但在 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.

柏林苍穹下 2024-07-11 06:09:25

您可以尝试延迟卸载:

umount -l

You might try a lazy unmount:

umount -l
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文