Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
How do I determine the block size of an ext3 partition on Linux?
# tune2fs -l /dev/sda1 | grep -i 'block size'
Block size: 1024
Replace /dev/sda1 with the partition you want to check.
Without root, without writing, and for any filesystem type, you can do:
stat -fc %s .
This will give block size of the filesystem mounted in current directory (or any other directory specified instead of the dot).
stat --printf='%s' -f .
dumpe2fs -h /dev/md2
will output something with:
Block size: 4096
Fragment size: 4096
On x86, a filesystem block is just about always 4KiB - the default size - and never larger than the size of a memory page (which is 4KiB).
In the case where you don't have the right to run tune2fs on a device (e.g. in a corporate environment) you can try writing a single byte to a file on the partition in question and check the disk usage:
echo 1 > test
du -h test
To detect block size of required partition:
Detect partition name:
$ df -h
for example we have /dev/sda1
Detect block size for this partition:
$ sudo blockdev --getbsz /dev/sda1
will also give file size in blocks
sudo dumpe2fs /dev/sda1 | grep "Block size"
where /dev/sda1 is the device partition. You can get it from lsblk
Required, but never shown