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