Linux Filesystems – How to Optimize for Lots of Small Files

ext4filesystemshard drivelinux

I have a drive containing 122,865 image files that are about 82.1 GB in total. However they use 171 GB of space on disk. The average file size is about 717KB. Since I intend to continue adding more files of this size I would like to reformat my drive with a new file system or alter the existing one to better accommodate these small files.

The drive is currently running ext4 with the defaults provided by ArchLinux's mkfs.ext4. I am not the slightest bit certain on where to begin with solving this, can anyone point me in the right direction or provide some resources for me to work with?

Best Answer

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
Related Question