最近游戏服务器硬盘爆满。
奇怪的是用 du /opt/
看只有25g
但是df看
却是
檔案系統 容量 已用 可用 已用% 掛載點
/dev/sda5 195G 23G 163G 13% /
/dev/sda2 68G 65G 0 100% /opt
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
搞不明白为什么会是65g
在/opt/目录下执行du --max-depth=1 -h
也只是20多G
后来无意间发现
lsof |grep delete命令可以查看已经删除的但是系统仍然在用的文件这些文件不会释放磁盘空间
才看到 有很多这样的资源 导致硬盘爆满
mysqld 1859 mysql 4u REG 8,5 0 45645829 /tmp/ibWdlI73 (deleted)
mysqld 1859 mysql 5u REG 8,5 0 45645830 /tmp/ib7hOICX (deleted)
mysqld 1859 mysql 6u REG 8,5 0 45645831 /tmp/ib2DrJ7Q (deleted)
mysqld 1859 mysql 7u REG 8,5 0 45645832 /tmp/ibP15b4K (deleted)
mysqld 1859 mysql 34u REG 8,5 0 45645833 /tmp/ibGnNBCG (deleted)
nginx 5135 root 2w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5135 root 4w REG 8,2 40241299485 16564444 /opt/nginx/logs/access.log (deleted)
nginx 5135 root 5w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5136 nobody 2w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5136 nobody 4w REG 8,2 40241299485 16564444 /opt/nginx/logs/access.log (deleted)
nginx 5136 nobody 5w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5137 nobody 2w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5137 nobody 4w REG 8,2 40241299485 16564444 /opt/nginx/logs/access.log (deleted)
nginx 5137 nobody 5w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5138 nobody 2w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5138 nobody 4w REG 8,2 40241299485 16564444 /opt/nginx/logs/access.log (deleted)
nginx 5138 nobody 5w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5139 nobody 2w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
nginx 5139 nobody 4w REG 8,2 40241299485 16564444 /opt/nginx/logs/access.log (deleted)
nginx 5139 nobody 5w REG 8,2 8201036 16564486 /opt/nginx/logs/error.log (deleted)
java 15027 root 11w REG 8,2 3911 15518134 /opt/tomcat.wgame/logs/logs.20130328/catalina.2013-03-28.log (deleted)
java 15027 root 12w REG 8,2 2058 15518161 /opt/tomcat.wgame/logs/logs.20130328/localhost.2013-03-28.log (deleted)
java 15027 root 13w REG 8,2 0 15518172 /opt/tomcat.wgame/logs/logs.20130328/manager.2013-03-28.log (deleted)
java 15027 root 14w REG 8,2 0 15518184 /opt/tomcat.wgame/logs/logs.20130328/admin.2013-03-28.log (deleted)
java 15027 root 15w REG 8,2 0 15518185 /opt/tomcat.wgame/logs/logs.20130328/host-manager.2013-03-28.log (deleted)
java 15027 root 63w REG 8,2 165413 15518332 /opt/tomcat.wgame/logs/wgame_s1_s2-deleteItemJob.log
java 15027 root 97w REG 8,2 10436 15518319 /opt/tomcat.wgame/logs/wgame_s3-deleteBattlefieldJob.log
java 15027 root 103w REG 8,2 10437 15518322 /opt/tomcat.wgame/logs/wgame_s1_s2-deleteBattlefieldJob.log
java 15027 root 104w REG 8,2 9850 15518323 /opt/tomcat.wgame/logs/wgame-deleteBattlefieldJob.log
java 15027 root 111w REG 8,2 272 15518331 /opt/tomcat.wgame/logs/wgame-deleteItemJob.log
java 15027 root 113w REG 8,2 172381 15518334 /opt/tomcat.wgame/logs/wgame_s3-deleteItemJob.log
mysqld_sa 23075 root 0u CHR 136,1 3 /dev/pts/1 (deleted)
mysqld_sa 23075 root 1u CHR 136,1 3 /dev/pts/1 (deleted)
mysqld_sa 23075 root 2u CHR 136,1 3 /dev/pts/1 (deleted)
然后结束这些服务后重启 服务
用df 查看
檔案系統 容量 已用 可用 已用% 掛載點
/dev/sda5 195G 25G 160G 14% /
/dev/sda2 68G 24G 41G 37% /opt
/dev/sda1 99M 12M 82M 13% /boot
tmpfs 16G 0 16G 0% /dev/shm
问题解决。