Optimizing file system for lots of small files?

The smaller the block size (1024 bytes, p.e.), the better for efficient disk usage, in case there's a lot of small files on that partition. Try to reformat that partition with the smallest block size:

mkfs.ext4 -b 1024 /dev/your_partition

Some time ago it was very common to use ReiserFS for that type of cases. I have no experience with it but I know that :)


In fact bigger block size is better for large items like multimedia files because it reduces the amount of metadata necessary for file management, resulting in less seeks required to read/write a file. Many cameras even format the SD card to a larger block size if you use the in-camera format feature. See

  • Best allocation unit size for video and photos
  • Changing Block/Cluster Size from 4K to 64K for Big File Storage (Game, 3D movie, HD Photo)
  • ext4 block size
  • Format partition to what block size for photos only

Reducing block size to 1024 bytes increases the metadata size significantly, and it'll perform far worse if your ext4 doesn't have extents enabled. Having a larger number of blocks also increases the level of indirection in case of ext2/3/4

So the solution is to increase the block size to at least 64 KB and use some filesystem that supports block suballocation to store the last odd-sized block of multiple files into a single block, saving memory. Some examples of such filesystems: ReiserFS, Reiser4, Btrfs and ZFS. They're optimized for a large number of files and is much better than ext4 in such situations. For more information read What filesystem can I use for a large amount of small-sized data?