Python 在 Ubuntu 报错 Errno=No space left on device (ENOSPC)

Tag: Python 
Posted on 2020-11-17

近日发现一个 Python 写的文件监控同步程序挂了,检查日志发现报错:

[2020-11-17 13:42:20,645 pyinotify ERROR] add_watch: cannot watch /*/*/*/* WD=-1, Errno=No space left on device (ENOSPC)
Google 之后发现是系统 watches 配额用尽,需要增大 watches 配额,默认 8192,增大 5 倍试试吧。

编辑 sysctl.conf 文件,然后更新:

echo fs.inotify.max_user_watches=40960 >> /etc/sysctl.conf
sysctl -p
再次重启 Python 脚本,正常运行。


另外,如果磁盘空间用尽,或者 Inode 节点用尽也会报此错误,df 命令可以查询使用情况。

查看存储空间:

df -h

查看 Inode 节点:

df -i
 评论
张三
orz
李四
orz orz
李小四
orz orz orz
张小三
orz orz orz orz
  搜索
  Tags
全部   Ubuntu   Linux   Python   Windows   Shell   转发   浏览器   js   KMS   循环   MySQL   字体   html   css   DNS   电源   多线程   反向代理   重定向   原创   WinSCP   随机   随机数   VSCode   venv   vbs   多进程   远程调试   字典   生活   激活   线程池   日志   数据库   网卡   截取字符   进度条   安装   进程池   领带   uuid   tc   IP   iostat   import   GitHub   dpkg   DHCP   curl   crx   CPU   cloud-init   Chrome   BBR   Apt   iptables   Kitsunebi   subprocess   SSH   SoftEther   Set   samba   pyflakes   pip   Office   Nginx   NextCloud   List   libreoffice   kvm   Adobe  
  功能
You can put anything you want inside of these side widgets. They are easy to use, and feature the new Bootstrap 4 card containers!