ubuntu 上运行的django 出现No space left on device错误

运行django出现错误信息:

[2016-02-16 14:33:24,476 pyinotify ERROR] add_watch: cannot watch /usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/cache.py WD=-1, Errno=No space left on device (ENOSPC) ERROR:pyinotify:add_watch: cannot watch /usr/local/lib/python2.7/dist-packages/django/contrib/sessions/backends/cache.py WD=-1, Errno=No space left on device (ENOSPC)

查询网络第一判断是缺少Inode节点: linux中创建一个文件不仅仅需要存储空间,也需要Inode节点。Inode节点在磁盘建立的时候就分配好最大的个数(每2K空间分配一个节点),一般情况下这个数目是够用的,但是如果磁盘拥有大量小文件(小于2k),就能将Inode节点用完。

查看存储空间

$df -h

查看i节点

$df -i

看是那种情况。

不幸的是我哪种都不是,后来在stackflow找到了答案。

问题原因:You may have reached your quota of watches.

解决办法

  查看目前的最大值

To find your current limit, type this in your terminal:

$cat /proc/sys/fs/inotify/max_user_watches

  增加最大值

Which is typically 8192 by default.

To increase your limit, type this:

$sudo sysctl fs.inotify.max_user_watches=16384

  永久设置最大值

Then restart django.

To permanently set this limit, type this:

$echo 16384 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
原文地址:https://www.cnblogs.com/yasmi/p/5192694.html