Preface
I create a media folder structure with Python consisting of hundred of thousands symbolic links. This folder structure allows me to navigate my media files like in a complex application, e.g. Kodi, but on file system level. In order to avoid many disk write operations I create the links on a RAM drive. The disk is mounted as follows:
# sudo mount -t tmpfs -o size=100M none /mnt/mem
The Issue
After creating many links the script outputs the following error:
[Errno 28] No space left on device: '...'@78596
If I check the actual disk usage, it returns the following:
$ df -h
// ...
none 100M 1,7M 99M 2% /mnt/mem
So according to my system, only 2 % are used!
The system is:
$ uname -a
Linux myServer 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux
After some investigation my script is able to create up to 90,000 links.
The Weird
If I try to reproduce the error on my desktop, it works flawlessly. I'm able to produce over 1,000,000 links with no issues. I don't know the actual limitation.
The system is:
$ uname -a
Linux myDesktop 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
The Questions
- What limits the number of symbolic links in linux?
- Can I bypass the limitation by upgrading the OS?
- Can I bypass the limitation by upgrading to a 64-bit architecture?
Some deep insights would be welcome!
Thanks.
-i
in that call todf
on both systems. This will tell you the number of available inodes. Each file (whether a symbolic link, directory, regular or other file) uses an inode. The number of allocatable inodes is determined when you create the filesystem. – Kusalananda Mar 12 '20 at 23:17