[CentOS] too many links error when creating directories

Fri Sep 28 06:04:24 UTC 2007
Bart Schaefer <barton.schaefer at gmail.com>

On 9/27/07, chitgoks <chitgoks at gmail.com> wrote:
> john yeah. a few images per directory (for now, maybe in the future more
> images). the directory name would point to the username.

The traditional way to deal with this would be to split up the
usernames alphabetically, e.g., make subdirectories of the top
directory for each of the 26 letters of the alphabet and then put the
directories matching the usernames in the subdirectory corresponding
to their first letter.

a/alice
b/bob
b/bill
c/charlie
e/etc

If you have more than 32000 users starting with any particular letter,
such as "s", then you do the same but with the first two letters:

s/m/smith
s/t/stevens

Of course all of this is just a trivial case of a hashing algorithm
where the extra layers of directories correspond to hash buckets, so
you can switch to a more complex hash if you prefer.