I'm trying to find the best way to store lots of small files on a volume, without hitting the inode limits. I created a new drive with:

sudo mkfs.ext4 -N 100000000 /dev/device

and this correctly shows:

/dev/device  100040704 13929894 86110810   14% /mnt/websites2

However, it seems to have made a fair hit to the speed for read/writes on that drive. I was doing some research, and came across:


They suggest:

sudo mkfs.ext4 -T largefile /dev/device

What is the option for "small files"? I can't seem to find any documentation on what the values of -T can be? Also - any other suggestions on how to configure a drive for LOTS of small files (~3-10kb each), would be much appreciated!

  • You should strongly consider using a different filesystem, such as XFS. Sep 19, 2020 at 16:32
  • @MichaelHampton thanks. What is the benefit of XFS? I'm afraid I'm not that knowledgable in the different types of filesystems Sep 20, 2020 at 5:59
  • How many is "lots" of files, order of magnitude? What is the distribution of files sizes? How many IOPS is the workload? What are you comparing to where this is a "fair hit to the speed": what was the other configuration, and quantify what the difference is? Sep 20, 2020 at 16:05
  • @JohnMahowald there are about 150 million files. The main hit I saw was the CPU load jumping quite a lot. Originally I stored the HTML in the MySQL table, but then I had problems with the drive filling up (and I didn't want to keep upgrading the server spec to get more disk space). In terms of the setup - I split them into 5 layers. So "foobar.com" would be put in /f/o/o/b/a/foobar.com.txt Sep 21, 2020 at 5:31

1 Answer 1


For lots of small files it's better to use,
mkfs.ext4 -T news /dev/device

There is also mkfs.ext4 -T small /dev/device but this sets a small inode size.

The labels for -T in mkfs.ext4 can be found in /etc/mke2fs.conf. You can find more info using man mke2fs and man mke2fs.conf

Apparently you need a large inode number and a small bytes/inode ratio. You could make a new label in /etc/mke2fs.conf and try some configurations to get the optimal performance for your scenario.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .