Understanding mke2fs Block Size Options in Linux

The mke2fs command is a fundamental Linux administration utility used to create ext2, ext3, and ext4 filesystems. Customizing the filesystem block size using the -b option in mke2fs is a critical optimization step that directly impacts disk space utilization, I/O throughput, maximum file size limitations, and system memory overhead. Choosing the correct block size allows system administrators to tailor storage performance specifically to the types of workloads and file distributions a system will handle.

How to Set Block Size in mke2fs

By default, mke2fs configures a filesystem with a 4096-byte (4 KiB) block size on most modern Linux architectures. To define a custom block size, administrators use the -b flag followed by the desired size in bytes:

sudo mke2fs -t ext4 -b 1024 /dev/sdb1

Supported block sizes typically range from 1024 to 4096 bytes on standard x86 systems (1024, 2048, and 4096), though architectures with larger memory page sizes (such as ARM64 or Itanium) can support larger blocks up to 64 KiB.

Storage Efficiency and Internal Fragmentation

The primary reason to adjust block size downward (e.g., to 1024 bytes) is to minimize internal fragmentation. Storage space on an ext-based filesystem is allocated in discrete block units. Even if a file contains only 100 bytes of data, the filesystem must allocate an entire block to store it.

I/O Throughput and Metadata Overhead

Block size choices directly influence read and write performance:

System Page Size Alignment

Linux manages virtual memory in pages, which are 4096 bytes on standard x86 architectures. When the filesystem block size matches the system page size:

Impact on File and Filesystem Limits

The block size defined during mke2fs execution hardens the maximum allowable individual file size and filesystem capacity. For example, in an ext3/ext4 architecture:

Selecting an inappropriately small block size can unintentionally restrict future storage expansion on that partition.

Summary of Usage Recommendations