Segfault > IT > How-To's > Filesystem & block size


If you have no other ways of finding out what is the size in bytes of the blocks of a filesystem (don't have any other utilities giving you this information), it is very easy to find this out on your own. This solution was provided by OSOR on - thanks a lot!

Write a file called blocks.c with the following C-source text in it:

  1. int main(int argc, char *argv[])
  2. {
  3. struct statvfs buf;
  4. if(statvfs(argv[1], &buf))
  5. {
  6. printf("Usage: blocks <block device>\n");
  7. exit(EXIT_FAILURE);
  8. }
  9. else
  10. {
  11. printf("File system block size: %lu\n", buf.f_bsize);
  12. printf("Fundamental file system block size: %lu\n", buf.f_frsize);
  13. }
  14. exit(EXIT_SUCCESS);
  15. }

Compile the whole thing with make blocks and run the program - e.g. "./blocks /dev/hda1".


fsutil fsinfo ntfsinfo

Have a look at the value of "Bytes Per Cluster".