1、df -h 查看硬盘使用情况,然后使用du -sh *命令删除大的文件,返回来查询依然使用率100%:
[root@**** /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G 38G 0 100% / tmpfs 1.9G 0 1.9G 0% /dev/shm
[root@iZ23c9tzxfmZ /]# du -sh * 7.6M bin 49M boot 160K dev 44M etc 4.0K home 272M lib 22M lib64 16K lost+found 4.0K media 4.0K mnt 8.0K opt du: cannot access `proc/2769/task/2769/fd/4': No such file or directory du: cannot access `proc/2769/task/2769/fdinfo/4': No such file or directory du: cannot access `proc/2769/fd/4': No such file or directory du: cannot access `proc/2769/fdinfo/4': No such file or directory 0 proc 116K root 15M sbin 4.0K selinux 4.0K srv 0 sys 196K tmp 1.8G usr 1.3G var
问题原因:删除文件后,文件删除进程未结束造成,使用 lsof |grep delete查看未结束进程,然后使用kill -9 结束进程
[root@iZ23c9tzxfmZ /]# lsof |grep delete java 578 root 8w REG 252,1 0 1324637 /usr/local/etc/apache-tomcat-9.0.12/logs/localhost.2019-06-07.log (deleted) mysqld 1091 mysql 4u REG 252,1 0 396339 /tmp/ib3ccYvb (deleted) mysqld 1091 mysql 5u REG 252,1 0 396341 /tmp/ibdSzxSO (deleted) mysqld 1091 mysql 6u REG 252,1 0 396342 /tmp/iby456es (deleted) mysqld 1091 mysql 7u REG 252,1 0 396401 /tmp/ibMTUnC5 (deleted) mysqld 1091 mysql 11u REG 252,1 0 396405 /tmp/ibfoSrxJ (deleted) java 2693 root 1w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 2693 root 2w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 2693 root 7w REG 252,1 92855255 1322738 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.2018-09-18.log (deleted) java 2693 root 8w REG 252,1 57824 1322739 /usr/local/etc/apache-tomcat-9.0.12/logs/localhost.2018-09-18.log (deleted) java 2693 root 9w REG 252,1 0 1324560 /usr/local/etc/apache-tomcat-9.0.12/logs/manager.2018-09-18.log (deleted) java 2693 root 10w REG 252,1 0 1324561 /usr/local/etc/apache-tomcat-9.0.12/logs/host-manager.2018-09-18.log (deleted) java 2844 root 1w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 2844 root 2w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 2844 root 7w REG 252,1 84798204 1320695 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.2019-07-26.log (deleted) java 2844 root 8w REG 252,1 57824 1322739 /usr/local/etc/apache-tomcat-9.0.12/logs/localhost.2018-09-18.log (deleted) java 2844 root 9w REG 252,1 0 1324560 /usr/local/etc/apache-tomcat-9.0.12/logs/manager.2018-09-18.log (deleted) java 2844 root 10w REG 252,1 0 1324561 /usr/local/etc/apache-tomcat-9.0.12/logs/host-manager.2018-09-18.log (deleted) java 3933 root 1w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 3933 root 2w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 3933 root 7w REG 252,1 92855255 1322738 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.2018-09-18.log (deleted) java 3933 root 8w REG 252,1 57824 1322739 /usr/local/etc/apache-tomcat-9.0.12/logs/localhost.2018-09-18.log (deleted) java 3933 root 9w REG 252,1 0 1324560 /usr/local/etc/apache-tomcat-9.0.12/logs/manager.2018-09-18.log (deleted) java 3933 root 10w REG 252,1 0 1324561 /usr/local/etc/apache-tomcat-9.0.12/logs/host-manager.2018-09-18.log (deleted) java 7192 root 1w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 7192 root 2w REG 252,1 36416065526 1322704 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.out (deleted) java 7192 root 7w REG 252,1 157118036 1324513 /usr/local/etc/apache-tomcat-9.0.12/logs/catalina.2018-09-20.log (deleted) java 7192 root 8w REG 252,1 37279 1310753 /usr/local/etc/apache-tomcat-9.0.12/logs/localhost.2018-09-20.log (deleted) java 7192 root 9w REG 252,1 0 1324516 /usr/local/etc/apache-tomcat-9.0.12/logs/manager.2018-09-20.log (deleted) java 7192 root 10w REG 252,1 0 1324517 /usr/local/etc/apache-tomcat-9.0.12/logs/host-manager.2018-09-20.log (deleted)
[root@iZ23c9tzxfmZ /]# kill-9 2693
[root@iZ23c9tzxfmZ /]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G 3.6G 34G 10% / tmpfs 1.9G 0 1.9G 0% /dev/shm