设备上没有剩余空间但磁盘未满

设备上没有剩余空间但磁盘未满
root@-50:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             32G     0   32G   0% /dev
tmpfs           6.3G  1.7M  6.3G   1% /run
/dev/md0        7.3T  7.0T     0 100% /
tmpfs            32G     0   32G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            32G     0   32G   0% /sys/fs/cgroup
tmpfs           6.3G     0  6.3G   0% /run/user/0

root@-50:~# sudo df -i /
Filesystem        Inodes IUsed     IFree IUse% Mounted on
/dev/md0       244174848 99780 244075068    1% /

我将其用作备份服务器,我曾错误地将其填满,但后来释放了空间,如上所示,但它仍然显示为 100% 已满。我尝试了自动删除和自动清理,还尝试了卸载 /tmp,但它显示未安装。有人知道这个问题的解决方案吗,服务器运行良好,但我需要更新其上运行的软件,但由于没有可用空间而无法更新。谢谢。

答案1

大多数 Linux 文件系统都会保留 5% 的分区空间供用户使用root。300GB 肯定是相当大的一部分,但你可以使用以下命令来确认这一点dumpe2fs

dumpe2fs /dev/md0 | grep -i reserved

这将给你如下输出:

dumpe2fs 1.45.5 (07-Jan-2020)
Reserved block count:     5838835
Reserved GDT blocks:      1024
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
  Reserved GDT blocks at 57-1080
  Reserved GDT blocks at 32825-33848
  Reserved GDT blocks at 98361-99384
  Reserved GDT blocks at 163897-164920
  Reserved GDT blocks at 229433-230456
  Reserved GDT blocks at 294969-295992
  Reserved GDT blocks at 819257-820280
  Reserved GDT blocks at 884793-885816
  Reserved GDT blocks at 1605689-1606712
  Reserved GDT blocks at 2654265-2655288
  Reserved GDT blocks at 4096057-4097080
  Reserved GDT blocks at 7962681-7963704
  Reserved GDT blocks at 11239481-11240504
  Reserved GDT blocks at 20480057-20481080
  Reserved GDT blocks at 23887929-23888952
  Reserved GDT blocks at 71663673-71664696
  Reserved GDT blocks at 78676025-78677048
  Reserved GDT blocks at 102400057-102401080

您还可以使用以下命令更改保留的空间量tune2fs

tune2fs -m 0 /dev/md0

如果在之前的配置工作中已将此 5% 预留设置为 0,则可能某个进程打开了一个大文件,但该文件后来已被删除。如果是这种情况,您需要终止该进程以释放被阻止的存储空间。您可能能够使用 来识别该进程。在 Ubuntu 上,已删除但打开的文件在输出中lsof被识别lsof并标记为。(deleted)

您可以使用以下方法检查:

sudo lsof +L1

它会给你类似这样的结果:

lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
lsof: WARNING: can't stat() fuse file system /run/user/1000/doc
      Output information may be incomplete.
COMMAND      PID     USER   FD   TYPE DEVICE SIZE/OFF NLINK     NODE NAME
none        1914     root  txt    REG    0,1    17032     0    43118 / (deleted)
pulseaudi   2185    jason    6u   REG    0,1 67108864     0    43740 /memfd:pulseaudio (deleted)
Xorg        2269    jason   37u   REG    0,1        4     0    46738 /memfd:xshmfence (deleted)
Xorg        2269    jason   51u   REG    0,1        4     0   188039 /memfd:xshmfence (deleted)
Xorg        2269    jason   52u   REG    0,1        4     0  1559738 /memfd:xshmfence (deleted)
Xorg        2269    jason   53u   REG    0,1        4     0  1559752 /memfd:xshmfence (deleted)
Xorg        2269    jason   54u   REG    0,1        4     0  1538559 /memfd:xshmfence (deleted)
Xorg        2269    jason   55u   REG    0,1        4     0  1538346 /memfd:xshmfence (deleted)
Xorg        2269    jason   59u   REG    0,1        4     0   329944 /memfd:xshmfence (deleted)
Xorg        2269    jason   68u   REG    0,1        4     0   312483 /memfd:xshmfence (deleted)
Xorg        2269    jason   70u   REG    0,1        4     0   312485 /memfd:xshmfence (deleted)
Xorg        2269    jason   71u   REG    0,1        4     0   310664 /memfd:xshmfence (deleted)
Xorg        2269    jason   72u   REG    0,1        4     0   312648 /memfd:xshmfence (deleted)
...

希望这能为您指明正确的方向。

相关内容