For single project, which uses a lot of images( ± 1k-3k per day) I use custom PHP script to process images and save them to server.
Currenty PHP script processes them and saves in the following folder structure: So the max lvl is 5. But currently I think how does following directory structure influences on inodes count? Should I put the lvl down to 2 or 3?
Every directory entry is an inode entry as well.
16**5 = 1,048,576
16**3 = 4,096
One year of images... 2,000 * 365 = 730,000.
That will give you roughly 178 per directory with a depth of 2. With a depth of 5, just over half utilization at all. Three sounds good to me. Maybe if you're in it for a decade I'd go to 4.
Every file and directory takes up an inode, but I don't think you're at much risk of exhausting inodes on a decent-sized filesystem -- at 5 levels deep, your directory tree will be taking up
16^5
or 1048576 inodes, which is a fair number, but not likely to overwhelm your filesystem. On the other hand, the number of files you store might cause some problems...It's a bit wasteful to only be using one hex digit per level, though -- I usually go to three digits per level (so
ab3/4f5/5e1/...
) as that puts 4096 directories at each level, which is well within the realm of sensible performance from a decent filesystem (don't go to 4, as extN only allows 32000 subdirectories in a single directory).Then, of course, there's the whole world of filesystems without fixed inode limits, and better performance in the face of massive numbers of files per directory, and no limit on the number of subdirectories...