加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

LINUX实战:Linux系统inode占满故障解决方法

发布时间:2020-12-13 17:45:22 所属栏目:Linux 来源:网络整理
导读:《LINUX实战:Linux系统inode占满故障解决方法》要点: 本文介绍了LINUX实战:Linux系统inode占满故障解决方法,希望对您有用。如果有疑问,可以联系我们。 众所周知,Linux文件系统中inode编码是指向磁盘block的唯一编号,若服务器遭入侵或日志文件将磁盘inod

《LINUX实战:Linux系统inode占满故障解决方法》要点:
本文介绍了LINUX实战:Linux系统inode占满故障解决方法,希望对您有用。如果有疑问,可以联系我们。

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

[root@CentOS7 ~]#? df -i /boot/? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #查看inode编号
Filesystem? ? Inodes IUsed IFree IUse% Mounted on
/dev/sda1? ? ? 1024064? 38 1024026? 1%? /boot
[root@centos7 ~] for i in {358..1024500}; do touch? file$i;done
[root@centos7 ~]# df -i /boot? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #发现inode占满
Filesystem? ? ? Inodes? IUsed IFree IUse%? Mounted on
/dev/sda1? ? ? 1024064 1024064? ? 0? 100% /boot
[root@centos7 ~]#? cd /boot? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
[root@centos7? boot]# touch 123.txt? ? ? ? ? ? ? ? ? ? ? ? ? ? #创建文件无法胜利
touch: cannot? touch ‘123.txt’: No space left on device

?办法一:通过传统方式利用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'

本文永远更新链接地址

学习更多LINUX教程,请查看站内专栏,如果有LINUX疑问,可以加QQ交流《LINUX实战:Linux系统inode占满故障解决方法》。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读