《LINUX實(shí)戰(zhàn):Linux系統(tǒng)inode占滿故障解決方法》要點(diǎn):
本文介紹了LINUX實(shí)戰(zhàn):Linux系統(tǒng)inode占滿故障解決方法,希望對您有用。如果有疑問,可以聯(lián)系我們。
眾所周知,Linux文件系統(tǒng)中inode編碼是指向磁盤block的唯一編號,若服務(wù)器遭入侵或日志文件將磁盤inode資源編號耗盡,新數(shù)據(jù)無法獲取inode編號導(dǎo)致無法存儲.舉例闡明:在磁盤中/boot獨(dú)立分區(qū)中查看現(xiàn)有inode資源并通過for循環(huán)創(chuàng)建大量文件占用耗盡inode編號,導(dǎo)致磁盤無法寫入內(nèi)容,最后進(jìn)行處理故障.
[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? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #發(fā)現(xiàn)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? ? ? ? ? ? ? ? ? ? ? ? ? ? #創(chuàng)建文件無法勝利
touch: cannot? touch ‘123.txt’: No space left on device
?辦法一:通過傳統(tǒng)方式利用for循環(huán)刪除文件,但是比較緩慢
[root@centos7 ~] for i in {950000..1024500}; do rm -rf? file$i;done #一點(diǎn)的刪除
?辦法二:利用傳參數(shù)的辦法快速有效的刪除文件
[root@centos7 boot]# ls file{400000..500000}|xargs rm 最為有效的辦法,傳參數(shù)
[root@centos7 boot]# ll file{600000..700000}|xargs rm ll列出的參數(shù)過多,傳給rm
ls: cannot access file600000: No such file or directory 時,rm不識別,因此通過
rm: invalid option -- 'w'? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ls顯示出獨(dú)立的文件名進(jìn)
Try 'rm --help' for more information.? ? ? ? ? ? ? ? ? ? 行傳遞.
rm: invalid option -- 'w'
本文永遠(yuǎn)更新鏈接地址:
學(xué)習(xí)更多LINUX教程,請查看站內(nèi)專欄,如果有LINUX疑問,可以加QQ交流《LINUX實(shí)戰(zhàn):Linux系統(tǒng)inode占滿故障解決方法》。
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/9011.html