Block size is selected at the time of high-level formatting, i.e., preparing the hard disk drive (HDD) or other media for creation of a filesystem. If the mke2fs (i.e., make ext2 filesystem) command is used to create the filesystem, valid block size vales are 1024, 2048 and 4096 bytes. If omitted, block size is determined by an algorithm that considers the size of the filesystem and how it is expected to be used.
The block size for any existing ext2 or ext3 filesystem (which are the most common filesystem types on Linux) can be obtained by using the dumpe2fs command with the device name as an argument (i.e., input data). The device name is the partition or disk on which the filesystem resides. A partition is a logically independent section of an HDD.
On most systems it will be necessary to be the root user (i.e., administrative user) in order to use dumpe2fs. On home computers and other systems for which the user has access to the root password, that user can become root by issuing the su (i.e., substitute user) command and then supplying the password as prompted. It will also likely be necessary to use the full pathname of dumpe2fs by adding /sbin to its beginning.
Thus, for example, to find the block size for the second partition of the first HDD, the following can be used:
Because dumpe2fs provides a large amount of information, it is convenient to use the filter grep to remove everything from the output except the block size. Because grep is case-sensitive and the word Block begins with an upper case (i.e., capital) B, it is necessary to use an upper case B in this command.
Created August 18, 2005.