1

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

ext4?

dynamic
  • 730
  • 6
  • 17
  • 31
  • possible duplicate of [How many maximum files per directory on CentOS 5 64bit or Linux RedHat 64bit?](http://serverfault.com/questions/77062/how-many-maximum-files-per-directory-on-centos-5-64bit-or-linux-redhat-64bit) – Sven Mar 17 '11 at 20:46
  • @sven: there isn't any answer in that question to how many files ext4 can handle per dir – dynamic Mar 17 '11 at 21:21

3 Answers3

4

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.

coredump
  • 12,573
  • 2
  • 34
  • 53
3

On ext4:

  • the subdirectory limit is 64000.
  • max number of files 4 billion (specified at filesystem creation time)
Sacx
  • 2,541
  • 15
  • 13
0

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).

Phil Hollenback
  • 14,647
  • 4
  • 34
  • 51
  • This is an overkill. Somewhere in ext4 specs should be known – dynamic 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