linux-error-no-space-left-on-device
CentOS 使用 service nginx restart 重启 nginx 服务报错: Error:No space left on device
发现问题
在执行 service nginx restart 重启 nginx 服务报错: Error:No space left on device
排查问题
1.查看磁盘空间实际占用情况 无异常
2.查看磁盘inodes占用情况 无异常
经过排查
1 | By default, Linux only allocates 8192 watches for inotify, which is ridiculously low. And when it runs out, the error is also No space left on device, which may be confusing if you aren't explicitly looking for this issue. |
查看 CentOS 默认 inotify 的 max_user_watches 值
1 | sysctl fs.inotify |
查看 CentOS 当前使用量
1 | find /proc/*/fd -user "$USER" -lname anon_inode:inotify -printf '%hinfo/%f\n' 2>/dev/null | xargs cat | grep -c '^inotify' |
发现已经超过了默认的最大值
解决问题
调整 max_user_watches 大小
1 | vim /etc/sysctl.conf |
刷新配置
1 | sysctl -p |
重启服务
1 | service nginx restart |
linux-error-no-space-left-on-device
https://orzsoft.com/post/d1e60750-2617-11ed-bb87-e926537fa011/