Go to the first, previous, next, last section, table of contents.


Block size

In the ext2 filesystem (at least until fragments are implemented), disk space is allocated to a file in units called blocks.

When you create a filesystem (using mkfs or mke2fs), you have the option of specifying the block size that all files on that filesystem will use, which will be either 1024, 2048, or 4096 bytes. (If you don't specify then the blocksize will be 1024 bytes.)

There is very little reason to use a blocksize other than 1024 bytes, by the way.(3)

(I try to use the term `filesystem blocks', because some people might otherwise think that I meant a different unit of storage when I write `block'. This document always intends `filesystem block' when it uses the noun `block'.)

In e2compr, cluster sizes are specified in terms of number of filesystem blocks rather than number of kilobytes. If you say `chattr -b 4 file', and file is on a filesystem with 4096-byte blocks, then file will use clusters of 16KB (i.e. 4 * 4096 \(4 \times 4096\) bytes). When you do `lsattr file', it will display `4' for the cluster size, which means 4 filesystem blocks (consistent with chattr), which means 16KB on a filesystem with 4096-byte blocks.

Fortunately, most people's filesystems have just 1024-byte blocks, in which case it doesn't matter whether they think in terms of kilobytes or filesystem blocks.


Go to the first, previous, next, last section, table of contents.