linux inode已满的解决方法

1.删除无用的临时文件,释放inode。

查找发现 /tmp 目录下有很多sess_xxxxx的 session临时文件。

#ls -lt /tmp | wc -l

4011517
进入/tmp目录,执行find -exec命令

# find /tmp -type f -exec rm {} \;
如果使用rm *,有可能因为文件数量太多而出现Argument list too long错误

 

2.除了/tmp的临时文件外,0字节的文件也会占用inode,应该也释放。

遍历寻找0字节的文件,并删除。

# find /home -type f -size 0 -exec rm {} \;

 

3 其他

#find /var/spool/exim/msglog/ -type f -name ‘*’ -print0 | xargs -0 rm -rf

#find /var/spool/exim/input/ -type f -name ‘*’ -print0 | xargs -0 rm -rf

 

注:网友提供的一条命令find */ ! -type l ” cut -d / -f 1 | uniq -c

据说执行完整个世界都清净了,威力太大,没敢试.