Linux系统inode占满故障解决方法

众所周知,Linux文件系统中inode编码是指向磁盘block的唯一编号,若服务器遭入侵或日志文件将磁盘inode资源编号耗尽,新数据无法获取inode编号导致无法存储。举例说明:在磁盘中/boot独立分区中查看现有inode资源并通过for循环创建大量文件占用耗尽inode编号,导致磁盘无法写入内容,最后进行处理故障。

 方法一:通过传统方式利用for循环删除文件,但是比较缓慢
[root@centos7 ~] for i in {950000..1024500}; do rm -rf  file$i;done #一点的删除

 方法二:利用传参数的方法快速有效的删除文件
[root@centos7 boot]# ls file{400000..500000}|xargs rm 最为有效的方法,传参数
[root@centos7 boot]# ll file{600000..700000}|xargs rm ll列出的参数过多,传给rm
ls: cannot access file600000: No such file or directory 时,rm不识别,因此通过
rm: invalid option -- 'w'                                ls显示出独立的文件名进
Try 'rm --help' for more information.                    行传递。
rm: invalid option -- 'w'

猜你喜欢

转载自www.linuxidc.com/Linux/2017-08/146458.htm