File system block size

user880946 picture user880946 · Dec 16, 2011 · Viewed 27.6k times · Source

What is the significance of the file system block size? If my Filesystem block size is set at say 8K does that mean that all read/write I/O will happen at size 8K? So if my application wants to read say 16 bytes at offset 4097 then a 4K block starting from offset 4096 will be read?

How do writes work in this case? Suppose I want to write say 64 bytes.

Answer

dmeister picture dmeister · Dec 16, 2011

You are right. The block size is the unit of work for the file system. Every read and write is done in full multiples of the block size.

The block size is also the smallest size on disk a file can have. If you have a 16 byte Block size,then a file with 16 bytes size occupies a full block on disk.

The book "Practical file system design" states:

Block: The smallest unit writable by a disk or file system. Everything a file system does is composed of operations done on blocks. A file system block is always the same size as or larger (in integer multiples) than the disk block size.