Filesystem block
A filesystem block is a filesystem-defined unit used to address file data or metadata, distinct from a device's logical sector.
Ext4 records structure locations as block numbers rather than absolute byte offsets; its block size is selected when the filesystem is created. This describes ext4's layout, not every system's use of the word block. [1]
With ext4 bigalloc, the allocation bitmap tracks clusters of multiple blocks. The filesystem block and allocation unit therefore describe different layers even within one filesystem. Neither name specifies an application's I/O request size. [2]
A small ext4 file may store its data inside the inode instead of receiving a separate data block. Distinguish logical file length, allocated data space and metadata when reporting storage use. [3]
FreeBSD newfs configures both a block size and a fragment size for UFS1/UFS2. Block size alone therefore does not specify the smallest allocation granularity. [4]
API fields named block size need their own units. On Linux, st_blksize is an I/O-size hint, whereas st_blocks counts allocated space in 512-byte units. Multiplying st_blocks by st_blksize is not the documented conversion to bytes. [5] These file-level fields are separate from statvfs block counters, which use f_frsize. [6]
Relations
- related
- Filesystem allocation unit, Ext4, ext4 bigalloc, Logical sector, File extent, Sparse file, statvfs
Citations
- Linux kernel documentation: ext4 blocks and block-number addressing
- Linux kernel documentation: ext4 clustered allocation
- Linux kernel documentation: ext4 inline data
- FreeBSD newfs(8): separate block-size and fragment-size parameters
- Linux man-pages: stat(3type), logical length, preferred I/O size and allocated-block units
- Linux man-pages: statvfs(3), block-counter units and field-availability limits
- Linux man-pages: stat(2), portability of st_blocks and st_blksize
Sources & caveats
- Ext4 is an explicit example, not a universal fixed-block-size requirement for all filesystems.
- The st_blocks and st_blksize interpretation above is scoped to Linux, not a cross-platform guarantee. [7]