blksize_t - Linux


blksize_t is a Linux command used to determine the optimal block size for a given file system. This information can be crucial for optimizing file system performance and storage utilization. It analyzes the file system and provides suggested block sizes based on factors such as file size distribution, access patterns, and hardware characteristics.


blksize_t [options] <file_system>


  • -a, –all: Show results for all filesystems.
  • -b, –bytes: Output block size in bytes (default).
  • -k, –kibibytes: Output block size in kibibytes (KiB).
  • -m, –megabytes: Output block size in megabytes (MiB).
  • -s, –sector-size: Show optimal sector size instead of block size.
  • -v, –verbose: Display additional information, including file system type and device name.


Display block size for the root filesystem:

blksize_t /

Show block sizes for all filesystems:

blksize_t -a

Display optimal sector size in megabytes:

blksize_t -s -m /dev/sda1

Common Issues

Incorrect output: Ensure that the specified file system is mounted and accessible.


fstrim: Use blksize_t to determine the optimal block size for fstrim optimizations, improving SSD performance:

fstrim --block-size $(blksize_t -b /dev/sda1) /dev/sda1

Related Commands

  • tune2fs: Adjust the block size of an ext4 file system.
  • mkfs: Create a new file system with a specified block size.
  • df: Display free disk space, including block size information.