xref: /linux/Documentation/filesystems/ext4/blocks.rst (revision b8d312aa075f33282565467662c4628dae0a2aff)
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.
14
15For 32-bit filesystems, limits are as follows:
16
17.. list-table::
18   :widths: 1 1 1 1 1
19   :header-rows: 1
20
21   * - Item
22     - 1KiB
23     - 2KiB
24     - 4KiB
25     - 64KiB
26   * - Blocks
27     - 2^32
28     - 2^32
29     - 2^32
30     - 2^32
31   * - Inodes
32     - 2^32
33     - 2^32
34     - 2^32
35     - 2^32
36   * - File System Size
37     - 4TiB
38     - 8TiB
39     - 16TiB
40     - 256PiB
41   * - Blocks Per Block Group
42     - 8,192
43     - 16,384
44     - 32,768
45     - 524,288
46   * - Inodes Per Block Group
47     - 8,192
48     - 16,384
49     - 32,768
50     - 524,288
51   * - Block Group Size
52     - 8MiB
53     - 32MiB
54     - 128MiB
55     - 32GiB
56   * - Blocks Per File, Extents
57     - 2^32
58     - 2^32
59     - 2^32
60     - 2^32
61   * - Blocks Per File, Block Maps
62     - 16,843,020
63     - 134,480,396
64     - 1,074,791,436
65     - 4,398,314,962,956 (really 2^32 due to field size limitations)
66   * - File Size, Extents
67     - 4TiB
68     - 8TiB
69     - 16TiB
70     - 256TiB
71   * - File Size, Block Maps
72     - 16GiB
73     - 256GiB
74     - 4TiB
75     - 256TiB
76
77For 64-bit filesystems, limits are as follows:
78
79.. list-table::
80   :widths: 1 1 1 1 1
81   :header-rows: 1
82
83   * - Item
84     - 1KiB
85     - 2KiB
86     - 4KiB
87     - 64KiB
88   * - Blocks
89     - 2^64
90     - 2^64
91     - 2^64
92     - 2^64
93   * - Inodes
94     - 2^32
95     - 2^32
96     - 2^32
97     - 2^32
98   * - File System Size
99     - 16ZiB
100     - 32ZiB
101     - 64ZiB
102     - 1YiB
103   * - Blocks Per Block Group
104     - 8,192
105     - 16,384
106     - 32,768
107     - 524,288
108   * - Inodes Per Block Group
109     - 8,192
110     - 16,384
111     - 32,768
112     - 524,288
113   * - Block Group Size
114     - 8MiB
115     - 32MiB
116     - 128MiB
117     - 32GiB
118   * - Blocks Per File, Extents
119     - 2^32
120     - 2^32
121     - 2^32
122     - 2^32
123   * - Blocks Per File, Block Maps
124     - 16,843,020
125     - 134,480,396
126     - 1,074,791,436
127     - 4,398,314,962,956 (really 2^32 due to field size limitations)
128   * - File Size, Extents
129     - 4TiB
130     - 8TiB
131     - 16TiB
132     - 256TiB
133   * - File Size, Block Maps
134     - 16GiB
135     - 256GiB
136     - 4TiB
137     - 256TiB
138
139Note: Files not using extents (i.e. files using block maps) must be
140placed within the first 2^32 blocks of a filesystem. Files with extents
141must be placed within the first 2^48 blocks of a filesystem. It's not
142clear what happens with larger filesystems.
143