I think some versions of
dumpfs or equivalent will emit this information, though the utility is filesystem-specific (e.g., for ext2, you could use
dumpe2fs -h /path/to/block/device). I dont think there is any standard utility that does this for any filesystem, although Im not sure why not. For example, you could do this (which is portable across all POSIX systems):
Code:
#include <stdio.h>
#include <stdlib.h>
#include <sys/statvfs.h>
int main(int argc, char *argv[])
{
struct statvfs buf;
if(statvfs(argv[1], &buf))
exit(EXIT_FAILURE);
printf("File system block size: %lu\n", buf.f_bsize);
printf("Fundamental file system block size: %lu\n", buf.f_frsize);
exit(EXIT_SUCCESS);
}
Compile the program with
make blocks (assuming you call it
blocks.c). Then just run the program as
./blocks /path/to/mountpoint (notice that the path is not to the block device, but to the mountpoint e.g., instead of
/dev/sda1 use
/usr).