/opt分区被web日志堆满了,导致一些服务无法正常运行,于是rm -fr掉这些日志(近11GB),但是服务仍没有恢复正常,用df -hT看,该分区占用还是100%:
[[email protected] opt]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda9 ext3 996M 228M 717M 25% /
/dev/sda10 ext3 27G 12G 14G 47% /var
/dev/sda8 ext3 996M 34M 911M 4% /home
/dev/sda7 ext3 2.0G 36M 1.9G 2% /temp
/dev/sda6 ext3 3.0G 2.6G 228M 92% /usr
/dev/sda3 ext3 19G 19G 0 100% /opt
/dev/sda1 ext3 99M 12M 83M 12% /boot
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
但是用du -sh /opt命令,看到:
[[email protected] /]# du -sh /opt/
8.3G /opt/
应该是删除了这些文件,但是空间没有释放,当然重启可以解决目的,但是会造成服务器上所有业务中断,可使用下面命令查看删除文件占用情况:
[[email protected] opt]# lsof |grep delete
mysqld_sa 11317 root cwd DIR 8,6 0 102107 /usr/local/mysql (deleted)
mysqld_sa 11317 root 255r REG 8,6 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 1w REG 8,3 5822263296 457562 /opt/tomcat/logs/catalina.out (deleted)
java 16961 root 2w REG 8,3 5822263296 457562 /opt/tomcat/logs/catalina.out (deleted)
java 16961 root 12w REG 8,3 5469261824 197191 /opt/tomcat/logs/catalina.2013-01-02.log (deleted)
java 16961 root 13w REG 8,3 2166784 197192 /opt/tomcat/logs/localhost.2013-01-02.log (deleted)
java 16961 root 14w REG 8,3 0 391681 /opt/tomcat/logs/manager.2013-01-02.log (deleted)
java 16961 root 15w REG 8,3 0 391682 /opt/tomcat/logs/host-manager.2013-01-02.log (deleted)
这里可以看到这些文件虽然删除了,但是还占用着空间,现在只要kill掉这些进程:
[[email protected] /]# kill -9 16961
[[email protected] /]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda9 ext3 996M 228M 717M 25% /
/dev/sda10 ext3 27G 12G 14G 47% /var
/dev/sda8 ext3 996M 34M 911M 4% /home
/dev/sda7 ext3 2.0G 36M 1.9G 2% /temp
/dev/sda6 ext3 3.0G 2.6G 228M 92% /usr
/dev/sda3 ext3 19G 8.4G 9.6G 47% /opt
/dev/sda1 ext3 99M 12M 83M 12% /boot
tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm
问题解决,服务也恢复整理啦…