1MKE2FS(8) System Manager's Manual MKE2FS(8)
2
3
4
6 mke2fs - create an ext2/ext3 filesystem
7
9 mke2fs [ -c | -l filename ] [ -b block-size ] [ -f fragment-size ] [ -g
10 blocks-per-group ] [ -i bytes-per-inode ] [ -I inode-size ] [ -j ] [ -J
11 journal-options ] [ -N number-of-inodes ] [ -n ] [ -m reserved-blocks-
12 percentage ] [ -o creator-os ] [ -O feature[,...] ] [ -q ] [ -r fs-
13 revision-level ] [ -E extended-options ] [ -v ] [ -F ] [ -L volume-
14 label ] [ -M last-mounted-directory ] [ -S ] [ -T filesystem-type ] [
15 -V ] device [ blocks-count ]
16
17 mke2fs -O journal_dev [ -b block-size ] [ -L volume-label ] [ -n ] [ -q
18 ] [ -v ] external-journal [ blocks-count ]
19
21 mke2fs is used to create an ext2/ext3 filesystem (usually in a disk
22 partition). device is the special file corresponding to the device
23 (e.g /dev/hdXX). blocks-count is the number of blocks on the device.
24 If omitted, mke2fs automagically figures the file system size. If
25 called as mkfs.ext3 a journal is created as if the -j option was speci‐
26 fied.
27
29 -b block-size
30 Specify the size of blocks in bytes. Valid block size vales are
31 1024, 2048 and 4096 bytes per block. If omitted, mke2fs block-
32 size is heuristically determined by the file system size and the
33 expected usage of the filesystem (see the -T option). If block-
34 size is negative, then mke2fs will use heuristics to determine
35 the appropriate block size, with the constraint that the block
36 size will be at least block-size bytes. This is useful for cer‐
37 tain hardware devices which require that the blocksize be a mul‐
38 tiple of 2k.
39
40 -c Check the device for bad blocks before creating the file system.
41 If this option is specified twice, then a slower, read-write
42 test is used instead of a fast read-only test.
43
44 -E extended-options
45 Set extended options for the filesystem. Extended options are
46 comma separated, and may take an argument using the equals ('=')
47 sign. The -E option used to be -R in earlier versions of
48 mke2fs. The -R option is still accepted for backwards compati‐
49 bility. The following extended options are supported:
50
51 stride=stripe-size
52 Configure the filesystem for a RAID array with
53 stripe-size filesystem blocks per stripe.
54
55 resize=max-online-resize
56 Reserve enough space so that the block group
57 descriptor table can grow to support a filesystem
58 that has max-online-resize blocks.
59
60 -f fragment-size
61 Specify the size of fragments in bytes.
62
63 -F Force mke2fs to create a filesystem, even if the specified
64 device is not a partition on a block special device, or if other
65 parameters do not make sense. In order to force mke2fs to cre‐
66 ate a filesystem even if the filesystem appears to be in use or
67 is mounted (a truly dangerous thing to do), this option must be
68 specified twice.
69
70 -g blocks-per-group
71 Specify the number of blocks in a block group. There is gener‐
72 ally no reason the user to ever set this parameter, as the
73 default is optimal for the filesystem. (For administrators who
74 are creating filesystems on RAID arrays, it is preferable to use
75 the stride RAID parameter as part of the -R option rather than
76 manipulating the number of blocks per group.) This option is
77 generally used by developers who are developing test cases.
78
79 -i bytes-per-inode
80 Specify the bytes/inode ratio. mke2fs creates an inode for
81 every bytes-per-inode bytes of space on the disk. The larger
82 the bytes-per-inode ratio, the fewer inodes will be created.
83 This value generally shouldn't be smaller than the blocksize of
84 the filesystem, since then too many inodes will be made. Be
85 warned that is not possible to expand the number of inodes on a
86 filesystem after it is created, so be careful deciding the cor‐
87 rect value for this parameter.
88
89 -I inode-size
90 Specify the size of each inode in bytes. mke2fs creates
91 128-byte inodes by default. In kernels after 2.6.10 and some
92 earlier vendor kernels it is possible to utilize larger inodes
93 to store extended attributes for improved performance. The
94 inode-size value must be a power of two larger or equal to 128.
95 The larger the inode-size the more space the inode table will
96 consume, and this reduces the usable space in the filesystem and
97 can also negatively impact performance. Using the default value
98 is always safe, though it may be desirable to use 256-byte
99 inodes if full backward compatibility is not a concern.
100 Extended attributes stored in large inodes are not visible with
101 older kernels, and such filesystems will not be mountable with
102 2.4 kernels at all. It is not possible to change this value
103 after the filesystem is created.
104
105 -j Create the filesystem with an ext3 journal. If the -J option is
106 not specified, the default journal parameters will be used to
107 create an appropriately sized journal (given the size of the
108 filesystem) stored within the filesystem. Note that you must be
109 using a kernel which has ext3 support in order to actually make
110 use of the journal.
111
112 -J journal-options
113 Create the ext3 journal using options specified on the command-
114 line. Journal options are comma separated, and may take an
115 argument using the equals ('=') sign. The following journal
116 options are supported:
117
118 size=journal-size
119 Create an internal journal (i.e., stored inside the
120 filesystem) of size journal-size megabytes. The
121 size of the journal must be at least 1024 filesystem
122 blocks (i.e., 1MB if using 1k blocks, 4MB if using
123 4k blocks, etc.) and may be no more than 102,400
124 filesystem blocks.
125
126 device=external-journal
127 Attach the filesystem to the journal block device
128 located on external-journal. The external journal
129 must already have been created using the command
130
131 mke2fs -O journal_dev external-journal
132
133 Note that external-journal must have been created
134 with the same block size as the new filesystem. In
135 addition, while there is support for attaching mul‐
136 tiple filesystems to a single external journal, the
137 Linux kernel and e2fsck(8) do not currently support
138 shared external journals yet.
139
140 Instead of specifying a device name directly, exter‐
141 nal-journal can also be specified by either
142 LABEL=label or UUID=UUID to locate the external
143 journal by either the volume label or UUID stored in
144 the ext2 superblock at the start of the journal.
145 Use dumpe2fs(8) to display a journal device's volume
146 label and UUID. See also the -L option of
147 tune2fs(8).
148
149 Only one of the size or device options can be given for a
150 filesystem.
151
152 -l filename
153 Read the bad blocks list from filename. Note that the block
154 numbers in the bad block list must be generated using the same
155 block size as used by mke2fs. As a result, the -c option to
156 mke2fs is a much simpler and less error-prone method of checking
157 a disk for bad blocks before formatting it, as mke2fs will auto‐
158 matically pass the correct parameters to the badblocks program.
159
160 -L new-volume-label
161 Set the volume label for the filesystem to new-volume-label.
162 The maximum length of the volume label is 16 bytes.
163
164 -m reserved-blocks-percentage
165 Specify the percentage of the filesystem blocks reserved for the
166 super-user. This avoids fragmentation, and allows root-owned
167 daemons, such as syslogd(8), to continue to function correctly
168 after non-privileged processes are prevented from writing to the
169 filesystem. The default percentage is 5%.
170
171 -M Set the last mounted directory for the filesystem. This might
172 be useful for the sake of utilities that key off of the last
173 mounted directory to determine where the filesystem should be
174 mounted.
175
176 -n causes mke2fs to not actually create a filesystem, but display
177 what it would do if it were to create a filesystem. This can be
178 used to determine the location of the backup superblocks for a
179 particular filesystem, so long as the mke2fs parameters that
180 were passed when the filesystem was originally created are used
181 again. (With the -n option added, of course!)
182
183 -N number-of-inodes
184 overrides the default calculation of the number of inodes that
185 should be reserved for the filesystem (which is based on the
186 number of blocks and the bytes-per-inode ratio). This allows
187 the user to specify the number of desired inodes directly.
188
189 -o creator-os
190 Manually override the default value of the "creator os" field of
191 the filesystem. Normally the creator field is set by default to
192 the native OS of the mke2fs executable.
193
194 -O feature[,...]
195 Create filesystem with given features (filesystem options),
196 overriding the default filesystem options. The default features
197 which are enabled by default are specified by the base_features
198 relation, either in the [libdefaults] section in the
199 /etc/mke2fs.conf configuration file, or in the subsection of the
200 [fs_types] section for the filesystem type as specified by the
201 -T option. The filesystem type-specific configuration setting
202 found in the [fs_types] section will override the global default
203 found in [libdefaults].
204
205 The filesystem feature set will be further edited using either
206 the feature set specification specified by this option, or if
207 this option is not specified, by the default_features relation
208 for the filesystem type being created, or in the [libdefaults]
209 section of the configuration file.
210
211 The filesystem feature set is comprised of a list of features,
212 separated by commas, that are to be enabled. To disable a fea‐
213 ture, simply prefix the feature name with a caret ('^') charac‐
214 ter. The pseudo-filesystem feature "none" will clear all
215 filesystem features.
216
217 dir_index
218 Use hashed b-trees to speed up lookups in large
219 directories.
220
221 filetype
222 Store file type information in directory entries.
223
224 has_journal
225 Create an ext3 journal (as if using the -j option).
226
227 journal_dev
228 Create an external ext3 journal on the given device
229 instead of a regular ext2 filesystem. Note that
230 external-journal must be created with the same block
231 size as the filesystems that will be using it.
232
233 resize_inode
234 Reserve space so the block group descriptor table
235 may grow in the future. Useful for online resizing
236 using resize2fs. By default mke2fs will attempt to
237 reserve enough space so that the filesystem may grow
238 to 1024 times its initial size. This can be changed
239 using resize extended option.
240
241 sparse_super
242 Create a filesystem with fewer superblock backup
243 copies (saves space on large filesystems).
244
245 -q Quiet execution. Useful if mke2fs is run in a script.
246
247 -r revision
248 Set the filesystem revision for the new filesystem. Note that
249 1.2 kernels only support revision 0 filesystems. The default is
250 to create revision 1 filesystems.
251
252 -S Write superblock and group descriptors only. This is useful if
253 all of the superblock and backup superblocks are corrupted, and
254 a last-ditch recovery method is desired. It causes mke2fs to
255 reinitialize the superblock and group descriptors, while not
256 touching the inode table and the block and inode bitmaps. The
257 e2fsck program should be run immediately after this option is
258 used, and there is no guarantee that any data will be salvage‐
259 able. It is critical to specify the correct filesystem block‐
260 size when using this option, or there is no chance of recovery.
261
262 -T fs-type
263 Specify how the filesystem is going to be used, so that mke2fs
264 can choose optimal filesystem parameters for that use. The
265 filesystem types that are can be supported are defined in the
266 configuration file /etc/mke2fs.conf(5). The default configura‐
267 tion file contains definitions for the filesystem types: small,
268 floppy, news, largefile, and largefile4.
269
270 -v Verbose execution.
271
272 -V Print the version number of mke2fs and exit.
273
275 This version of mke2fs has been written by Theodore Ts'o
276 <tytso@mit.edu>.
277
279 mke2fs accepts the -f option but currently ignores it because the sec‐
280 ond extended file system does not support fragments yet.
281 There may be other ones. Please, report them to the author.
282
284 mke2fs is part of the e2fsprogs package and is available from
285 http://e2fsprogs.sourceforge.net.
286
288 mke2fs.conf(5), badblocks(8), dumpe2fs(8), e2fsck(8), tune2fs(8)
289
290
291
292E2fsprogs version 1.40.2 July 2007 MKE2FS(8)