在 RHEL 6.10 服务器上有一个已安装的 NAS,我无法删除既没有 也rm -rf
没有 的目录rmdir
。两者都失败了rm: cannot remove "backup/backup.1": Directory not empty
。我确定要使用ls -ali
,并尝试 --ignore-fail-on-non-empty
过rmdir
。我看到了建议这是我strace
得到ls
的:
execve("/bin/ls", ["ls", "rsync-test/backup/backup.4/"], [/* 29 vars */]) = 0
brk(0) = 0x12e2000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3728926000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=49961, ...}) = 0
mmap(NULL, 49961, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3728919000
close(3) = 0
open("/lib64/libselinux.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0PY`,1\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=124640, ...}) = 0
mmap(0x312c600000, 2221912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x312c600000
mprotect(0x312c61d000, 2093056, PROT_NONE) = 0
mmap(0x312c81c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x312c81c000
mmap(0x312c81e000, 1880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x312c81e000
close(3) = 0
open("/lib64/librt.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240!\340+1\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=47760, ...}) = 0
mmap(0x312be00000, 2128816, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x312be00000
mprotect(0x312be07000, 2093056, PROT_NONE) = 0
mmap(0x312c006000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x312c006000
close(3) = 0
open("/lib64/libcap.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\23`11\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19016, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3728918000
mmap(0x3131600000, 2111776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3131600000
mprotect(0x3131604000, 2093056, PROT_NONE) = 0
mmap(0x3131803000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x3131803000
close(3) = 0
open("/lib64/libacl.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\36\34001\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=33816, ...}) = 0
mmap(0x3130e00000, 2126416, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3130e00000
mprotect(0x3130e07000, 2093056, PROT_NONE) = 0
mmap(0x3131006000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x3131006000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\356\1\2237\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1930416, ...}) = 0
mmap(0x3793000000, 3750184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3793000000
mprotect(0x379318b000, 2093056, PROT_NONE) = 0
mmap(0x379338a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x379338a000
mmap(0x3793390000, 14632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3793390000
close(3) = 0
open("/lib64/libdl.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\r@\2237\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=23088, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3728917000
mmap(0x3793400000, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3793400000
mprotect(0x3793402000, 2097152, PROT_NONE) = 0
mmap(0x3793602000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3793602000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000^`+1\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=146592, ...}) = 0
mmap(0x312b600000, 2212848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x312b600000
mprotect(0x312b617000, 2097152, PROT_NONE) = 0
mmap(0x312b817000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x312b817000
mmap(0x312b819000, 13296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x312b819000
close(3) = 0
open("/lib64/libattr.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\23`.1\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=21152, ...}) = 0
mmap(0x312e600000, 2113888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x312e600000
mprotect(0x312e604000, 2093056, PROT_NONE) = 0
mmap(0x312e803000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x312e803000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3728916000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3728914000
arch_prctl(ARCH_SET_FS, 0x7f37289147a0) = 0
mprotect(0x312c81c000, 4096, PROT_READ) = 0
mprotect(0x312c006000, 4096, PROT_READ) = 0
mprotect(0x3131006000, 4096, PROT_READ) = 0
mprotect(0x379338a000, 16384, PROT_READ) = 0
mprotect(0x3793602000, 4096, PROT_READ) = 0
mprotect(0x3792e20000, 4096, PROT_READ) = 0
mprotect(0x312b817000, 4096, PROT_READ) = 0
mprotect(0x312e803000, 4096, PROT_READ) = 0
munmap(0x7f3728919000, 49961) = 0
set_tid_address(0x7f3728914a70) = 37574
set_robust_list(0x7f3728914a80, 24) = 0
futex(0x7ffca56b8aec, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x7ffca56b8aec, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7f37289147a0) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x312b605cb0, [], SA_RESTORER|SA_SIGINFO, 0x312b60f7e0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x312b605d40, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x312b60f7e0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/selinux", {f_type="EXT2_SUPER_MAGIC", f_bsize=4096, f_blocks=7708159, f_bfree=6845829, f_bavail=6452613, f_files=1966080, f_ffree=1827695, f_fsid={-881742105, 1365551766}, f_namelen=255, f_frsize=4096}) = 0
brk(0) = 0x12e2000
brk(0x1303000) = 0x1303000
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) = 0x7f3728925000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 1024) = 365
read(3, "", 1024) = 0
close(3) = 0
munmap(0x7f3728925000, 4096) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99170352, ...}) = 0
mmap(NULL, 99170352, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3722a80000
close(3) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=59, ws_col=194, ws_xpixel=0, ws_ypixel=0}) = 0
stat("rsync-test/backup/backup.4/", {st_mode=S_IFDIR|0777, st_size=840, ...}) = 0
open("rsync-test/backup/backup.4/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
getdents(3, /* 3 entries */, 32768) = 80
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f3728925000
write(1, "Thesis\n", 7) = 7
close(1) = 0
munmap(0x7f3728925000, 4096) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++
对于 rm 的 strace:
execve("/bin/rm", ["rm", "-rf", "backup"], [/* 29 vars */]) = 0
brk(0) = 0x116f000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa627552000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=49961, ...}) = 0
mmap(NULL, 49961, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa627545000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\356\1\2237\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1930416, ...}) = 0
mmap(0x3793000000, 3750184, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3793000000
mprotect(0x379318b000, 2093056, PROT_NONE) = 0
mmap(0x379338a000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x379338a000
mmap(0x3793390000, 14632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3793390000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa627544000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa627543000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa627542000
arch_prctl(ARCH_SET_FS, 0x7fa627543700) = 0
mprotect(0x379338a000, 16384, PROT_READ) = 0
mprotect(0x3792e20000, 4096, PROT_READ) = 0
munmap(0x7fa627545000, 49961) = 0
brk(0) = 0x116f000
brk(0x1190000) = 0x1190000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99170352, ...}) = 0
mmap(NULL, 99170352, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa6216ae000
close(3) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
lstat("/", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0
newfstatat(AT_FDCWD, "backup", {st_mode=S_IFDIR|0755, st_size=1960, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(AT_FDCWD, "backup", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0755, st_size=1960, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
mmap(NULL, 135168, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa62168d000
fcntl(3, F_DUPFD, 3) = 4
fcntl(4, F_GETFD) = 0
fcntl(4, F_SETFD, FD_CLOEXEC) = 0
getdents(3, /* 7 entries */, 131072) = 208
getdents(3, /* 0 entries */, 131072) = 0
munmap(0x7fa62168d000, 135168) = 0
close(3) = 0
newfstatat(4, "backup.1", {st_mode=S_IFDIR|0777, st_size=840, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(4, "backup.1", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=840, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
brk(0x11b2000) = 0x11b2000
fcntl(3, F_DUPFD, 3) = 5
fcntl(5, F_GETFD) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
getdents(3, 0x1171b10, 131072) = -1 ENOENT (No such file or directory)
close(3) = 0
close(5) = 0
unlinkat(4, "backup.1", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2512, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa6216ad000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2512
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7fa6216ad000, 4096) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=435, ...}) = 0
mmap(NULL, 435, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa6216ad000
close(3) = 0
write(2, "rm: ", 4) = 4
write(2, "cannot remove `backup/backup.1'", 31) = 31
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Directory not empty", 21) = 21
write(2, "\n", 1) = 1
newfstatat(4, "backup.2", {st_mode=S_IFDIR|0777, st_size=840, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(4, "backup.2", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=840, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(3, F_DUPFD, 3) = 5
fcntl(5, F_GETFD) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
getdents(3, 0x1173290, 131072) = -1 ENOENT (No such file or directory)
close(3) = 0
close(5) = 0
unlinkat(4, "backup.2", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
write(2, "rm: ", 4) = 4
write(2, "cannot remove `backup/backup.2'", 31) = 31
write(2, ": Directory not empty", 21) = 21
write(2, "\n", 1) = 1
newfstatat(4, "backup.3", {st_mode=S_IFDIR|0777, st_size=840, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(4, "backup.3", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=840, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(3, F_DUPFD, 3) = 5
fcntl(5, F_GETFD) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
getdents(3, 0x1173290, 131072) = -1 ENOENT (No such file or directory)
close(3) = 0
close(5) = 0
unlinkat(4, "backup.3", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
write(2, "rm: ", 4) = 4
write(2, "cannot remove `backup/backup.3'", 31) = 31
write(2, ": Directory not empty", 21) = 21
write(2, "\n", 1) = 1
newfstatat(4, "backup.4", {st_mode=S_IFDIR|0777, st_size=840, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(4, "backup.4", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=840, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(3, F_DUPFD, 3) = 5
fcntl(5, F_GETFD) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
getdents(3, /* 3 entries */, 131072) = 80
getdents(3, /* 0 entries */, 131072) = 0
close(3) = 0
newfstatat(5, "Thesis", {st_mode=S_IFDIR|0777, st_size=840, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(5, "Thesis", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=840, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(3, F_DUPFD, 3) = 6
fcntl(6, F_GETFD) = 0
fcntl(6, F_SETFD, FD_CLOEXEC) = 0
getdents(3, /* 3 entries */, 131072) = 80
getdents(3, /* 0 entries */, 131072) = 0
close(3) = 0
newfstatat(6, "notebook", {st_mode=S_IFDIR|0777, st_size=1120, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(6, "notebook", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=1120, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(3, F_DUPFD, 3) = 7
fcntl(7, F_GETFD) = 0
fcntl(7, F_SETFD, FD_CLOEXEC) = 0
getdents(3, 0x1173290, 131072) = -1 ENOENT (No such file or directory)
close(3) = 0
close(7) = 0
unlinkat(6, "notebook", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
write(2, "rm: ", 4) = 4
write(2, "cannot remove `backup/backup.4/T"..., 47) = 47
write(2, ": Directory not empty", 21) = 21
write(2, "\n", 1) = 1
close(6) = 0
close(5) = 0
newfstatat(4, "backup.6", {st_mode=S_IFDIR|0777, st_size=1120, ...}, AT_SYMLINK_NOFOLLOW) = 0
openat(4, "backup.6", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY) = 3
fcntl(3, F_GETFD) = 0
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fstat(3, {st_mode=S_IFDIR|0777, st_size=1120, ...}) = 0
fcntl(3, F_GETFL) = 0x18800 (flags O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY)
fcntl(3, F_SETFD, FD_CLOEXEC) = 0
fcntl(3, F_DUPFD, 3) = 5
fcntl(5, F_GETFD) = 0
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
getdents(3, 0x1173290, 131072) = -1 ENOENT (No such file or directory)
close(3) = 0
close(5) = 0
unlinkat(4, "backup.6", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
write(2, "rm: ", 4) = 4
write(2, "cannot remove `backup/backup.6'", 31) = 31
write(2, ": Directory not empty", 21) = 21
write(2, "\n", 1) = 1
close(4) = 0
close(0) = 0
close(1) = 0
close(2) = 0
exit_group(1) = ?
+++ exited with 1 +++
是否 unlinkat(4, "backup.6", AT_REMOVEDIR) = -1 ENOTEMPTY (Directory not empty)
提供任何线索?
答案1
警告您似乎正在尝试删除备份文件。我建议要小心。如果您使用的是成熟的设备,可能会有有关管理(修改/删除/调整大小)备份文件的文档。如果有令人困惑的文档,您可以发布有关它们的信息。
使用 rm -rf 时,请务必指定目录,即 rm -rf backup/
确保您拥有删除该文件的权限。
尝试对您遇到问题的文件运行 lsof。在 FD 列下,您应该能够看到是否有与该备份关联的任何文件描述符。您也许还可以找到与该文件关联的 PID。然后,您可以关闭与该资源关联的文件描述符或终止与该文件关联的进程。