Reputation: 9396
See error message below, I get this while trying to create a new directory with Python's native os library.
...
File "files.py", line 93, in create_dir
os.makedirs(d)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 31] Too many links: '/var/lib/kaas/77520'
I can see that there are just above 32000 directories already in this directory
$ ll | wc -l
32001
Is there a limit on the OS level for how many directories that can be created or what is causing the issue here? Or is this a Python limitation?
I'm running Ubuntu 12.04.4 LTS.
Upvotes: 2
Views: 4443
Reputation: 41
This is a ext3 filesystem limitation.
Check out http://en.wikipedia.org/wiki/Ext3#cite_note-17
You can upgrade to ext4, in ext4 there no such limitation about subdirectories.
http://en.wikipedia.org/wiki/Ext4#cite_note-12
Upvotes: 2
Reputation: 1375
Your filesystem might be built with a 32000 subdir limit(which is a default on many systems, but in general ext3 seems to have a variable limit which can be set while creating the FS). So, the maximum number of subdirectories you can have in a directory is 31,998. Check this post out: http://blog.ryanrampersad.com/2008/08/warning-mkdir-too-many-links/ (The comments are interesting)
Upvotes: 2
Reputation: 799082
The 32000 directory entry limit is a filesystem-level ext3 limit.
Upvotes: 8