[SLL] limit on number of files in a directory and hashed dir vs. flat dir file access time
Rob Smith
kormoc at gmail.com
Wed Oct 31 18:39:18 PDT 2007
On 10/31/07, Xeno Campanoli <xcampanoli at gmail.com> wrote:
> implying that the maximum number of links to anything is 32000, which
> limits a directory to 32000 files.
Not true.
That's the number of links to a file, not a inode.
Using this script:
#!/bin/bash
I=0
mkdir /tmp/filetest
cd /tmp/filetest
while [ "$I" -lt "50000" ]
do
touch $I
let I=$I+1
done
echo "There is `ls | wc -l` files in this directory"
it creates 50,000 files quite fine.
Now using this script:
#!/bin/bash
mkdir /tmp/linktest
cd /tmp/linktest
touch mainlink
I=0
while [ "$I" -lt "32005" ]
do
ln mainlink $I
let I=$I+1
done
it will fail to create the last 6 links, as too many links.
Ext3 will be glad to store trillions of files in a single dir, and
with the dirindex b-tree hashes, it's not all that slow.
~Rob
More information about the linux-list
mailing list