Linux

Httpd:設備上沒有剩餘空間

  • May 22, 2020

我正在使用 Fedora 17,在過去的幾天裡,我的系統出現了問題。每當我嘗試啟動時httpd,它都會向我顯示:

Error: No space left on device

當我執行systemctl status httpd.service時,我收到以下輸出:

httpd.service - The Apache HTTP Server (prefork MPM)
         Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
         Active: inactive (dead) since Tue, 19 Feb 2013 11:18:57 +0530; 2s ago
        Process: 4563 ExecStart=/usr/sbin/httpd $OPTIONS -k start (code=exited, status=0/SUCCESS)
         CGroup: name=systemd:/system/httpd.service

我試圖用Google搜尋這個錯誤,所有連結都指向清除信號量。我不認為這是問題,因為我試圖清除信號量,但沒有奏效。

編輯 1

這是輸出df -g

[root@localhost ~]# df -h
Filesystem              Size  Used Avail Use% Mounted on
rootfs                   50G   16G   32G  34% /
devtmpfs                910M     0  910M   0% /dev
tmpfs                   920M  136K  920M   1% /dev/shm
tmpfs                   920M  1.2M  919M   1% /run
/dev/mapper/vg-lv_root   50G   16G   32G  34% /
tmpfs                   920M     0  920M   0% /sys/fs/cgroup
tmpfs                   920M     0  920M   0% /media
/dev/sda1               497M   59M  424M  13% /boot
/dev/mapper/vg-lv_home  412G  6.3G  385G   2% /home

這是httpd錯誤日誌的詳細資訊

[root@localhost ~]# tail -f /var/log/httpd/error_log
[Tue Feb 19 11:45:53 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Feb 19 11:45:53 2013] [notice] Digest: generating secret for digest authentication ...
[Tue Feb 19 11:45:53 2013] [notice] Digest: done
[Tue Feb 19 11:45:54 2013] [notice] Apache/2.2.23 (Unix) DAV/2 PHP/5.4.11 configured -- resuming normal operations
[Tue Feb 19 11:47:23 2013] [notice] caught SIGTERM, shutting down
[Tue Feb 19 11:48:00 2013] [notice] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Tue Feb 19 11:48:00 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Feb 19 11:48:00 2013] [notice] Digest: generating secret for digest authentication ...
[Tue Feb 19 11:48:00 2013] [notice] Digest: done
[Tue Feb 19 11:48:00 2013] [notice] Apache/2.2.23 (Unix) DAV/2 PHP/5.4.11 configured -- resuming normal operations
tail: inotify resources exhausted
tail: inotify cannot be used, reverting to polling

編輯2 這裡是輸出df-i

[root@localhost ~]# df -i
Filesystem               Inodes  IUsed    IFree IUse% Mounted on
rootfs                  3276800 337174  2939626   11% /
devtmpfs                 232864    406   232458    1% /dev
tmpfs                    235306      3   235303    1% /dev/shm
tmpfs                    235306    438   234868    1% /run
/dev/mapper/vg-lv_root  3276800 337174  2939626   11% /
tmpfs                    235306     12   235294    1% /sys/fs/cgroup
tmpfs                    235306      1   235305    1% /media
/dev/sda1                128016    339   127677    1% /boot
/dev/mapper/vg-lv_home 26984448    216 26984232    1% /home

謝謝

在這裡,我們看到了問題的證據:

tail: inotify resources exhausted

預設情況下,Linux 只為 inotify 分配了 8192 個 watch,這個值低得離譜。當它用完時,錯誤也是No space left on device,如果你沒有明確地尋找這個問題,這可能會令人困惑。

使用適當的 sysctl 提高此值:

fs.inotify.max_user_watches = 262144

(將其添加到/etc/sysctl.conf然後執行sysctl -p。)

引用自:https://unix.stackexchange.com/questions/65278