^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) Blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ext4 allocates storage space in units of “blocks”. A block is a group of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) sectors between 1KiB and 64KiB, and the number of sectors must be an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) integral power of 2. Blocks are in turn grouped into larger units called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) block groups. Block size is specified at mkfs time and typically is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 4KiB. You may experience mounting problems if block size is greater than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) page size (i.e. 64KiB blocks on a i386 which only has 4KiB memory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) pages). By default a filesystem can contain 2^32 blocks; if the '64bit'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) feature is enabled, then a filesystem can have 2^64 blocks. The location
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) of structures is stored in terms of the block number the structure lives
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) in and not the absolute offset on disk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) For 32-bit filesystems, limits are as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) :widths: 1 1 1 1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * - Item
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) - 1KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) - 2KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) - 4KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) - 64KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * - Blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * - Inodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * - File System Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) - 4TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) - 8TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) - 16TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) - 256PiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * - Blocks Per Block Group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) - 8,192
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) - 16,384
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) - 32,768
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) - 524,288
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * - Inodes Per Block Group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) - 8,192
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) - 16,384
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) - 32,768
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) - 524,288
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * - Block Group Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) - 8MiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) - 32MiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) - 128MiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) - 32GiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * - Blocks Per File, Extents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * - Blocks Per File, Block Maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) - 16,843,020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) - 134,480,396
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) - 1,074,791,436
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) - 4,398,314,962,956 (really 2^32 due to field size limitations)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * - File Size, Extents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) - 4TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) - 8TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) - 16TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) - 256TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * - File Size, Block Maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) - 16GiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) - 256GiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) - 4TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) - 256TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) For 64-bit filesystems, limits are as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .. list-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) :widths: 1 1 1 1 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) :header-rows: 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * - Item
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) - 1KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) - 2KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) - 4KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) - 64KiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * - Blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) - 2^64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) - 2^64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) - 2^64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) - 2^64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * - Inodes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * - File System Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) - 16ZiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) - 32ZiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) - 64ZiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) - 1YiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * - Blocks Per Block Group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) - 8,192
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) - 16,384
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) - 32,768
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) - 524,288
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * - Inodes Per Block Group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) - 8,192
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) - 16,384
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) - 32,768
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) - 524,288
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * - Block Group Size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) - 8MiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) - 32MiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) - 128MiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) - 32GiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * - Blocks Per File, Extents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) - 2^32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * - Blocks Per File, Block Maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) - 16,843,020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) - 134,480,396
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) - 1,074,791,436
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) - 4,398,314,962,956 (really 2^32 due to field size limitations)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * - File Size, Extents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) - 4TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) - 8TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) - 16TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) - 256TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * - File Size, Block Maps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) - 16GiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) - 256GiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) - 4TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) - 256TiB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) Note: Files not using extents (i.e. files using block maps) must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) placed within the first 2^32 blocks of a filesystem. Files with extents
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) must be placed within the first 2^48 blocks of a filesystem. It's not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) clear what happens with larger filesystems.