linux inode已滿解決方案,linuxinode

來源:互聯網
上載者:User

linux inode已滿解決方案,linuxinode

linux inode已滿解決方案


今天login server的一個網站,發現login後沒有產生session。根據以往經驗,一般是空間已滿導致session檔案產生失敗。

df -hFilesystem                    Size  Used Avail Use% Mounted on/dev/mapper/dev01-root         75G   58G   14G  82% /udev                          2.0G  4.0K  2.0G   1% /devtmpfs                         396M  292K  396M   1% /runnone                          5.0M     0  5.0M   0% /run/locknone                          2.0G  4.0K  2.0G   1% /run/shm/dev/sda1                     228M  149M   68M  69% /boot

空間剩餘14G,可以排除空間已滿的情況。導致檔案產生失敗還有另一個原因,就是檔案索引節點inode已滿。

df -iFilesystem                    Inodes   IUsed  IFree IUse% Mounted on/dev/mapper/dev01-root       4964352 4964352      0  100% /udev                          503779     440 503339    1% /devtmpfs                         506183     353 505830    1% /runnone                          506183       5 506178    1% /run/locknone                          506183       2 506181    1% /run/shm/dev/sda1                     124496     255 124241    1% /boot

inodes 佔用100%,果然是這個問題。


解決方案:刪除無用的臨時檔案,釋放inode。

尋找發現 /tmp 目錄下有很多sess_xxxxx的 session臨時檔案。

ls -lt /tmp | wc -l4011517

進入/tmp目錄,執行find -exec命令

sudo find /tmp -type f -exec rm {} \;

如果使用rm *,有可能因為檔案數量太多而出現Argument list too long錯誤,關於Argument list too long錯誤可以參考《linux Argument list too long錯誤解決方案》


除了/tmp的臨時檔案外,0位元組的檔案也會佔用inode,應該也釋放。

遍曆尋找0位元組的檔案,並刪除。

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

刪除後,inode 的使用量減少為19%,可以正常使用了。

df -iFilesystem                    Inodes  IUsed   IFree IUse% Mounted on/dev/mapper/dev01-root       4964352 940835 4023517   19% /udev                          503779    440  503339    1% /devtmpfs                         506183    353  505830    1% /runnone                          506183      5  506178    1% /run/locknone                          506183      2  506181    1% /run/shm/dev/sda1                     124496    255  124241    1% /boot


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.