《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占滿故障解決方法》。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/9011.html