ext [234] file systems have a fixed maximum number of indexes; Each file or directory requires one inode. You can see the current counter and limits with df -i . For example, on an ext3 file system of 15 GB, created with default settings:
Filesystem Inodes IUsed IFree IUse% Mounted on /dev/xvda 1933312 134815 1798497 7% /
There are no restrictions on directories, in particular outside of this; keep in mind that each file or directory requires at least one file system block (typically 4 KB), although even if it is a directory with a single item in it.
As you can see, 80,000 inodes are unlikely to be a problem. And with the dir_index option (amenable to tune2fs ), searching in large directories is not too big. However, note that many administrative tools (such as ls or rm ) can hardly cope with directories with too many files in them. Therefore, it is recommended that you split your files so that you do not have more than a few hundred thousand items in any directory. An easy way to do this is to hash any identifier you use and use the first few hexadecimal digits as intermediate directories.
For example, let's say you have element ID 12345 and it hashes to 'DEADBEEF02842.......' . You can store files under /storage/root/d/e/12345 . Now you have reduced the number of files in each directory by 1 / 256th.
bdonlan Nov 23 '11 at 8:14 2011-11-23 08:14
source share