up vote 0 down vote favorite
share [g+] share [fb]

I know of fat32 being of 65.000 files per dir, what about linux/debian?

ext4?

link|improve this question

80% accept rate
@sven: there isn't any answer in that question to how many files ext4 can handle per dir – yes123 Mar 17 '11 at 21:21
feedback

3 Answers

up vote 3 down vote accepted

It depends on your filesystem. Ext3 has the following limits:

  • Maximum number of sub-directories: 32000 (hardcoded)
  • Maximum number of inodes (maximum number of files and directories on the whole system): the default is calculated based on the volume size in bytes (default number of inodes = V/2^13)

Other filesystems will have different limits, some will limit files inside a dir while others don't. Refer to your filesystem documentation for more info.

You can see some Ext4 limits on this question.

link|improve this answer
debian 6 uses ext4 (what i am interested about) anyway +1 – yes123 Mar 17 '11 at 21:26
@yes check my comment – coredump Mar 17 '11 at 21:30
ok! df -i shows how many free inode are left, what i wanted (atm i have 44mil inode free, i have some margin xD) – yes123 Mar 17 '11 at 21:40
@yes yes unless you are running a mailserver with Maildir store, no spam filtering and millions of users, you are ok :P – coredump Mar 17 '11 at 23:25
feedback

On ext4:

  • the subdirectory limit is 64000.
  • max number of files 4 billion (specified at filesystem creation time)
link|improve this answer
max number of files 4 billion per directory? or 4bil per entire filesystem? – yes123 Mar 17 '11 at 21:38
feedback

Well, why don't you test your machine?

#!/bin/bash

i=1
mkdir testdir || exit 1
cd testdir || exit 1

while true
do
  [ $(($i % 1000)) -eq 0 ] && echo "creating file $i"
  touch file.$i || { echo "failed to create file.$i"; exit 1; }
  ((i++))
done

Please, please don't run that on a production server. The system could become very sluggish as it creates massive numbers of files.

Also note that deleting a directory full of many, many thousands of files could also take a very long time (like hours).

link|improve this answer
This is an overkill. Somewhere in ext4 specs should be known – yes123 Mar 17 '11 at 21:23
Don't do that, you may end doing a kind of a DDOS on a machine, and depending on the FS you may end using ALL the available inodes. – coredump Mar 17 '11 at 21:24
And by DDOS I mean DOS. – coredump Mar 17 '11 at 21:31
Oh heck you guys, it's just a fun experiment to run. I clearly say don't do it on a production server. Specs are fine but it's always useful to experiment as well. Also note that some filesystems get massive performance problems above a certain number of files per dir, this is a good way to detect that. – Phil Hollenback Mar 17 '11 at 21:42
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.