Solution to CentOS disk usage of 100%
The/opt partition is full of web logs, causing some services to fail to run normally. Therefore, rm-fr drops these logs (nearly 11 GB), but the services are still not recovered, if df-hT is used, the partition still occupies 100% space:
[Root @ anjingopt] # df-hT file system type capacity in use available % mount point/dev/sda9 ext3 996 M 228 M 717 M 25% // dev/sda10 ext3 27G 12G 14G 47%/var/dev/sda8 ext3 996 M 34 M 911 M 4%/home/dev/sda7 ext3 2.0G 36 M 1.9G 2%/temp/dev/sda6 ext3 3.0G 2.6G 228 M 92%/usr/dev/sda3 ext3 19G 19G 0 100%/opt/dev/sda1 ext3 99 M 12 M 83 M 12%/boottmpfs tmpfs 2.0G 0 2.0G 0%/dev/shm
However, run the du-sh/opt command and you can see:
[Root @ anjing/] # du-sh/opt/8.3G/opt/
These files should have been deleted, but the space has not been released. Of course, restarting can solve the problem, but may cause all service interruptions on the server. You can run the following command to check the File Usage:
[Root @ anjing opt] # lsof | grep deletemysqld_sa 11317 root cwd DIR 8, 6 0 102107/usr/local/mysql (deleted) mysqld_sa 11317 root 255r REG 13620 102182/usr/local/mysql/bin/mysqld_safe (deleted) mysqld 11353 mysql txt REG 8, 6 29382763 102138/usr/local/mysql/bin/mysqld (deleted) mysqld 11353 mysql 5u REG 8, 9 0 58761/tmp/ibpfbHsa (deleted) mysqld 11353 mysql 6u REG 8, 9 0 58771/tmp/ibqoMnag (deleted) mysqld 11353 mysql 7u REG 8, 9 0 58772/tmp/ibN4C4Rl (deleted) mysqld 11353 mysql 8u REG 8, 9 0 58781/tmp/ibkWP8zr (deleted) mysqld 11353 mysql 12u REG 8, 9 0 58782/tmp/ibnqrZsx (deleted) java 16961 root 1 w REG 5822263296 457562/opt/tomcat/logs/catalina. out (deleted) java 16961 root 2 w REG 5822263296 457562/opt/tomcat/logs/catalina. out (deleted) java 16961 root 12 w REG 5469261824 197191/opt/tomcat/logs/catalina.2013-01-02.log (deleted) java 16961 root 13 w REG 2166784 197192/opt/tomcat/logs/localhost.2013-01-02.log (deleted) java 16961 root 14 w REG 391681/opt/tomcat/logs/manager.2013-01-02.log (deleted) java 16961 root 15 w REG 391682/opt/tomcat/logs/host-manager.2013-01-02.log (deleted)
Although these files are deleted, they still occupy space. Now, you only need to kill these processes:
[Root @ anjing/] # kill-9 16961 [root @ anjing/] # df-hT file system type capacity in use available % mount point/dev/sda9 ext3 996 M 228 M 717 M 25% // dev/sda10 ext3 27G 12G 14G 47%/var/dev/sda8 ext3 996 M 34 M 911 M 4%/home/dev/sda7 ext3 2.0G 36 M 1.9G 2%/temp/dev/sda6 ext3 3.0G 2.6G 228 M 92%/usr/dev/sda3 ext3 19G 8.4G 9.6G 47%/opt/dev/sda1 ext3 99 M 12 M 83 M 12%/boottmpfs tmpfs 2.0G 0 2.0G 0%/dev/shm
Solve the problem and restore the service...