centos-root df -h不更新磁盘大小
[root@kafka1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 238G 194G 44G 82% /
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 865M 7.0G 11% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/vda1 1014M 143M 872M 15% /boot
/dev/mapper/centos-home 10G 3.1G 7.0G 31% /home
tmpfs 1.6G 0 1.6G 0% /run/user/0
经过命令 du -sh /* 命令 逐步查找,并且已经删除占用磁盘较大的文件
查找一些已经删除但是并未被线程释放的文件
[root@kafka1 ~]# ls -ld /proc/*/fd/* 2>&1 | fgrep '(deleted)'
l-wx------. 1 root root 64 Oct 8 13:39 /proc/26153/fd/1 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-nodemanager-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/26153/fd/2 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-nodemanager-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/26153/fd/264 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-nodemanager-kafka1.log (deleted)
l-wx------. 1 root root 64 Oct 8 13:36 /proc/30214/fd/1 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-namenode-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:36 /proc/30214/fd/2 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-namenode-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:36 /proc/30214/fd/251 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-namenode-kafka1.log (deleted)
l-wx------. 1 root root 64 Oct 8 13:36 /proc/30214/fd/252 -> /opt/module/hadoop-3.1.3/logs/SecurityAuth-root.audit (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/30450/fd/1 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-datanode-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/30450/fd/2 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-datanode-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/30450/fd/251 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-datanode-kafka1.log (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/30450/fd/252 -> /opt/module/hadoop-3.1.3/logs/SecurityAuth-root.audit (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/31044/fd/1 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-historyserver-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/31044/fd/2 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-historyserver-kafka1.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/31044/fd/251 -> /opt/module/hadoop-3.1.3/logs/hadoop-root-historyserver-kafka1.log (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/62821/fd/1 -> /opt/module/hadoop-3.1.3/logs/userlogs/application_1692326817695_0013/container_1692326817695_0013_01_000002/prelaunch.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/62821/fd/2 -> /opt/module/hadoop-3.1.3/logs/userlogs/application_1692326817695_0013/container_1692326817695_0013_01_000002/prelaunch.err (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/62872/fd/1 -> /opt/module/hadoop-3.1.3/logs/userlogs/application_1692326817695_0013/container_1692326817695_0013_01_000002/taskmanager.out (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/62872/fd/2 -> /opt/module/hadoop-3.1.3/logs/userlogs/application_1692326817695_0013/container_1692326817695_0013_01_000002/taskmanager.err (deleted)
l-wx------. 1 root root 64 Oct 8 13:39 /proc/62872/fd/250 -> /opt/module/hadoop-3.1.3/logs/userlogs/application_1692326817695_0013/container_1692326817695_0013_01_000002/taskmanager.log (deleted)
lr-x------. 1 root root 64 Oct 8 13:39 /proc/668/fd/24 -> /run/log/journal/de670f9411ff418ebe119fec002700c1/system@2078c02c945747f8a45cc7b1151427c9-000000000107b5d8-000612511c5580eb.journal (deleted)
lrwx------. 1 root root 64 Oct 8 13:39 /proc/979/fd/7 -> /tmp/ffi9MfQnG (deleted)
kill 掉这些进程。
总结办法
1.找出那个进程占用了哪些已删除的文件
查看哪些被文件还在被哪个进程占用
ls -ld /proc/*/fd/* 2>&1 | fgrep '(deleted)'
2.斟酌考虑后执行kill命令
3.执行df看看是否已经刷新成功
杀掉之后就释放了