我在 Linux 中有一个挂载点,它在 lsof 或 fuser 中没有显示任何打开的文件。挂载点已在 NFS 中导出,但不再导出,并且挂载点中没有其他文件或目录。我们已检查以确保目录中没有人,甚至还计算并检查了 bash 进程。此时,我们完全搞不懂为什么我们无法卸载挂载点。
[root@head-02 proc]# umount /PoolB/daily.2020.12.13
umount: /PoolB/daily.2020.12.13: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
我们没有在 NFS 中导出的目录:
[root@head-02 proc]# showmount -e localhost
Export list for localhost:
/PoolB/LegacyExchange 172.18.10.0/24
/PoolB/Customers 172.18.10.0/24
/PoolB/Import 172.18.10.0/24
FUSER 的输出:
[root@head-02 proc]# fuser -vm /PoolB/daily.2020.12.13
USER PID ACCESS COMMAND
/PoolB/daily.2020.12.13:
root kernel mount /PoolB/daily.2020.12.13
LSOF 的输出:
[root@head-02 proc]# lsof +D /PoolB/daily.2020.12.13
[root@head-02 proc]#
该系统是 ZFS On Linux 系统,因此我可以尝试更改那里的挂载点或将其删除。最终目标是从 ZPOOL 中删除文件系统:
[root@head-02 proc]# zfs set mountpoint=legacy PoolB/daily.2020.12.13
umount: /PoolB/daily.2020.12.13: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
cannot unmount '/PoolB/daily.2020.12.13': umount failed
[root@head-02 proc]#
我甚至尝试删除文件系统:
[root@head-02 proc]# zfs destroy PoolB/daily.2020.12.13
umount: /PoolB/daily.2020.12.13: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))
cannot unmount '/PoolB/daily.2020.12.13': umount failed
[root@head-02 proc]#
出于无奈,以下是失败的 umount 命令的 strace 输出:
[root@head-02 proc]# strace umount /PoolB/daily.2020.12.13
execve("/usr/bin/umount", ["umount", "/PoolB/daily.2020.12.13"], 0x7ffcd33fef18 /* 22 vars */) = 0
brk(NULL) = 0x55d4721b9000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4088778000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=22424, ...}) = 0
mmap(NULL, 22424, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4088772000
close(3) = 0
open("/lib64/libmount.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\237\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=277808, ...}) = 0
mmap(NULL, 2370944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4088315000
mprotect(0x7f4088355000, 2097152, PROT_NONE) = 0
mmap(0x7f4088555000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x40000) = 0x7f4088555000
mmap(0x7f4088557000, 3456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4088557000
close(3) = 0
open("/lib64/libblkid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\207\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=265600, ...}) = 0
mmap(NULL, 2358152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f40880d5000
mprotect(0x7f4088111000, 2093056, PROT_NONE) = 0
mmap(0x7f4088310000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3b000) = 0x7f4088310000
mmap(0x7f4088314000, 2952, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4088314000
close(3) = 0
open("/lib64/libuuid.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\24\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=20064, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4088771000
mmap(NULL, 2113920, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4087ed0000
mprotect(0x7f4087ed4000, 2093056, PROT_NONE) = 0
mmap(0x7f40880d3000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f40880d3000
close(3) = 0
open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320i\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=155784, ...}) = 0
mmap(NULL, 2255184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4087ca9000
mprotect(0x7f4087ccd000, 2093056, PROT_NONE) = 0
mmap(0x7f4087ecc000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x23000) = 0x7f4087ecc000
mmap(0x7f4087ece000, 6480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4087ece000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20&\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=2156160, ...}) = 0
mmap(NULL, 3985888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f40878db000
mprotect(0x7f4087a9e000, 2097152, PROT_NONE) = 0
mmap(0x7f4087c9e000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c3000) = 0x7f4087c9e000
mmap(0x7f4087ca4000, 16864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4087ca4000
close(3) = 0
open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\25\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=402384, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4088770000
mmap(NULL, 2494984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4087679000
mprotect(0x7f40876d9000, 2097152, PROT_NONE) = 0
mmap(0x7f40878d9000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x60000) = 0x7f40878d9000
close(3) = 0
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\r\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19288, ...}) = 0
mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4087475000
mprotect(0x7f4087477000, 2097152, PROT_NONE) = 0
mmap(0x7f4087677000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f4087677000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@m\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=142232, ...}) = 0
mmap(NULL, 2208904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f4087259000
mprotect(0x7f4087270000, 2093056, PROT_NONE) = 0
mmap(0x7f408746f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7f408746f000
mmap(0x7f4087471000, 13448, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f4087471000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f408876f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f408876e000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f408876c000
arch_prctl(ARCH_SET_FS, 0x7f408876c880) = 0
mprotect(0x7f4087c9e000, 16384, PROT_READ) = 0
mprotect(0x7f408746f000, 4096, PROT_READ) = 0
mprotect(0x7f4087677000, 4096, PROT_READ) = 0
mprotect(0x7f40878d9000, 4096, PROT_READ) = 0
mprotect(0x7f4087ecc000, 4096, PROT_READ) = 0
mprotect(0x7f40880d3000, 4096, PROT_READ) = 0
mprotect(0x7f4088310000, 12288, PROT_READ) = 0
mprotect(0x7f4088555000, 4096, PROT_READ) = 0
mprotect(0x55d470fcf000, 4096, PROT_READ) = 0
mprotect(0x7f4088779000, 4096, PROT_READ) = 0
munmap(0x7f4088772000, 22424) = 0
set_tid_address(0x7f408876cb50) = 37241
set_robust_list(0x7f408876cb60, 24) = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7f408725f820, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f40872685f0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7f408725f8b0, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f40872685f0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/sys/fs/selinux", 0x7fffc7932c50) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fffc7932c50) = -1 ENOENT (No such file or directory)
brk(NULL) = 0x55d4721b9000
brk(0x55d4721da000) = 0x55d4721da000
open("/proc/filesystems", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4088777000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tr"..., 1024) = 350
stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7fffc7932830) = -1 ENOENT (No such file or directory)
read(3, "", 1024) = 0
close(3) = 0
munmap(0x7f4088777000, 4096) = 0
access("/etc/selinux/config", F_OK) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=106075056, ...}) = 0
mmap(NULL, 106075056, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f4080d2f000
close(3) = 0
getuid() = 0
geteuid() = 0
getuid() = 0
geteuid() = 0
getgid() = 0
getegid() = 0
prctl(PR_GET_DUMPABLE) = 1 (SUID_DUMP_USER)
lstat("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=17, ...}) = 0
getuid() = 0
geteuid() = 0
getgid() = 0
getegid() = 0
prctl(PR_GET_DUMPABLE) = 1 (SUID_DUMP_USER)
stat("/run", {st_mode=S_IFDIR|0755, st_size=960, ...}) = 0
lstat("/run/mount/utab", 0x7fffc7932b50) = -1 ENOENT (No such file or directory)
mkdir("/run/mount", 0755) = -1 EEXIST (File exists)
stat("/run/mount/utab", 0x7fffc7932a40) = -1 ENOENT (No such file or directory)
stat("/run/mount", {st_mode=S_IFDIR|0755, st_size=40, ...}) = 0
geteuid() = 0
getegid() = 0
getuid() = 0
getgid() = 0
access("/run/mount", R_OK|W_OK) = 0
stat("/PoolB/daily.2020.12.13", {st_mode=S_IFDIR|0755, st_size=39, ...}) = 0
readlink("/PoolB", 0x7fffc79309b0, 4096) = -1 EINVAL (Invalid argument)
readlink("/PoolB/daily.2020.12.13", 0x7fffc79309b0, 4096) = -1 EINVAL (Invalid argument)
lstat("/etc/mtab", {st_mode=S_IFLNK|0777, st_size=17, ...}) = 0
open("/proc/self/mountinfo", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4088777000
read(3, "18 41 0:18 / /sys rw,nosuid,node"..., 1024) = 1024
stat("/etc/sysconfig/64bit_strstr_via_64bit_strstr_sse2_unaligned", 0x7fffc7930370) = -1 ENOENT (No such file or directory)
read(3, "rfs efivarfs rw\n29 25 0:25 / /sy"..., 1024) = 1024
read(3, "ev,noexec,relatime shared:19 - c"..., 1024) = 1024
read(3, ",xattr,posixacl\n131 128 0:42 / /"..., 1024) = 1024
read(3, " - zfs PoolB/daily.2020.12.13 rw"..., 1024) = 145
readlink("/proc", 0x7fffc7930830, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc/self", "37241", 4096) = 5
readlink("/proc/37241", 0x7fffc7930830, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc/37241/mountinfo", 0x7fffc7930830, 4096) = -1 EINVAL (Invalid argument)
read(3, "", 1024) = 0
close(3) = 0
munmap(0x7f4088777000, 4096) = 0
getuid() = 0
geteuid() = 0
getgid() = 0
getegid() = 0
prctl(PR_GET_DUMPABLE) = 1 (SUID_DUMP_USER)
stat("/run", {st_mode=S_IFDIR|0755, st_size=960, ...}) = 0
stat("/run/mount/utab", 0x7fffc79328c0) = -1 ENOENT (No such file or directory)
stat("/sbin/umount.zfs", 0x7fffc7931a80) = -1 ENOENT (No such file or directory)
stat("/sbin/fs.d/umount.zfs", 0x7fffc7931a80) = -1 ENOENT (No such file or directory)
stat("/sbin/fs/umount.zfs", 0x7fffc7931a80) = -1 ENOENT (No such file or directory)
stat("/run/mount/utab", 0x7fffc7932b30) = -1 ENOENT (No such file or directory)
umount2("/PoolB/daily.2020.12.13", 0) = -1 EBUSY (Device or resource busy)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2502, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4088777000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2502
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7f4088777000, 4096) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "umount: ", 8umount: ) = 8
write(2, "/PoolB/daily.2020.12.13: target "..., 153/PoolB/daily.2020.12.13: target is busy.
(In some cases useful info about processes that use
the device is found by lsof(8) or fuser(1))) = 153
write(2, "\n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(32) = ?
+++ exited with 32 +++
[root@head-02 proc]#
如您所见,strace 显示系统调用 umount2 因 EBUSY 而失败,该系统调用的手册页中只显示“目标正忙”。
我们甚至删除了成功运行的文件系统的所有内容rm -rf /PoolB/daily.2020.12.13/
。我们没有交换空间,并且它没有列在 /etc/exports 中。
我们现在不知所措,出于显而易见的原因,重新启动系统无论如何都是不可能的。我们不应该因为必须卸载文件系统而重新启动。任何建议都将不胜感激。
Linux 内核版本是 3.10.0-1062.4.3.el7.x86_64 ZFS 版本是 0.8.2-1.el7,zfs-dkms 包也是如此。
感谢您读到这里。
答案1
这可能是一个显而易见的问题,但您在帖子中没有提到它。
您是否尝试过将 force 选项与 umount ( umount -f
) 一起使用?
它专门用于卸载过时/无法访问的网络文件系统(如 NFS)(因此可能不完全适合您的情况)。
如果 force 没有帮助,您还可以尝试 lazy umount。
来自手册页:
-f, --force
Force an unmount (in case of an unreachable NFS system)
-l, --lazy
Lazy unmount. Detach the filesystem from the file
hierarchy now, and clean up all references to this
filesystem as soon as it is not busy anymore.