1TUNE2FS(8) System Manager's Manual TUNE2FS(8)
2
3
4
6 tune2fs - adjust tunable filesystem parameters on ext2/ext3/ext4
7 filesystems
8
10 tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ] [ -f ] [
11 -i interval-between-checks ] [ -I new_inode_size ] [ -j ] [ -J journal-
12 options ] [ -m reserved-blocks-percentage ] [ -o [^]mount-options[,...]
13 ] [ -r reserved-blocks-count ] [ -u user ] [ -g group ] [ -C mount-
14 count ] [ -E extended-options ] [ -L volume-label ] [ -M last-mounted-
15 directory ] [ -O [^]feature[,...] ] [ -Q quota-options ] [ -T time-
16 last-checked ] [ -U UUID ] [ -z undo_file ] device
17
19 tune2fs allows the system administrator to adjust various tunable
20 filesystem parameters on Linux ext2, ext3, or ext4 filesystems. The
21 current values of these options can be displayed by using the -l option
22 to tune2fs(8) program, or by using the dumpe2fs(8) program.
23
24 The device specifier can either be a filename (i.e., /dev/sda1), or a
25 LABEL or UUID specifier: "LABEL=volume-label" or "UUID=uuid". (i.e.,
26 LABEL=home or UUID=e40486c6-84d5-4f2f-b99c-032281799c9d).
27
29 -c max-mount-counts
30 Adjust the number of mounts after which the filesystem will be
31 checked by e2fsck(8). If max-mount-counts is 0 or -1, the num‐
32 ber of times the filesystem is mounted will be disregarded by
33 e2fsck(8) and the kernel.
34
35 Staggering the mount-counts at which filesystems are forcibly
36 checked will avoid all filesystems being checked at one time
37 when using journaled filesystems.
38
39 Mount-count-dependent checking is disabled by default to avoid
40 unanticipated long reboots while e2fsck does its work. However,
41 you may wish to consider the consequences of disabling mount-
42 count-dependent checking entirely. Bad disk drives, cables,
43 memory, and kernel bugs could all corrupt a filesystem without
44 marking the filesystem dirty or in error. If you are using
45 journaling on your filesystem, your filesystem will never be
46 marked dirty, so it will not normally be checked. A filesystem
47 error detected by the kernel will still force an fsck on the
48 next reboot, but it may already be too late to prevent data loss
49 at that point.
50
51 See also the -i option for time-dependent checking.
52
53 -C mount-count
54 Set the number of times the filesystem has been mounted. If set
55 to a greater value than the max-mount-counts parameter set by
56 the -c option, e2fsck(8) will check the filesystem at the next
57 reboot.
58
59 -e error-behavior
60 Change the behavior of the kernel code when errors are detected.
61 In all cases, a filesystem error will cause e2fsck(8) to check
62 the filesystem on the next boot. error-behavior can be one of
63 the following:
64
65 continue Continue normal execution.
66
67 remount-ro Remount filesystem read-only.
68
69 panic Cause a kernel panic.
70
71 -E extended-options
72 Set extended options for the filesystem. Extended options are
73 comma separated, and may take an argument using the equals ('=')
74 sign. The following extended options are supported:
75
76 clear_mmp
77 Reset the MMP block (if any) back to the clean
78 state. Use only if absolutely certain the device is
79 not currently mounted or being fscked, or major
80 filesystem corruption can result. Needs '-f'.
81
82 mmp_update_interval=interval
83 Adjust the initial MMP update interval to interval
84 seconds. Specifying an interval of 0 means to use
85 the default interval. The specified interval must
86 be less than 300 seconds. Requires that the mmp
87 feature be enabled.
88
89 stride=stride-size
90 Configure the filesystem for a RAID array with
91 stride-size filesystem blocks. This is the number of
92 blocks read or written to disk before moving to next
93 disk. This mostly affects placement of filesystem
94 metadata like bitmaps at mke2fs(2) time to avoid
95 placing them on a single disk, which can hurt the
96 performance. It may also be used by block alloca‐
97 tor.
98
99 stripe_width=stripe-width
100 Configure the filesystem for a RAID array with
101 stripe-width filesystem blocks per stripe. This is
102 typically be stride-size * N, where N is the number
103 of data disks in the RAID (e.g. RAID 5 N+1, RAID 6
104 N+2). This allows the block allocator to prevent
105 read-modify-write of the parity in a RAID stripe if
106 possible when the data is written.
107
108 hash_alg=hash-alg
109 Set the default hash algorithm used for filesystems
110 with hashed b-tree directories. Valid algorithms
111 accepted are: legacy, half_md4, and tea.
112
113 mount_opts=mount_option_string
114 Set a set of default mount options which will be
115 used when the file system is mounted. Unlike the
116 bitmask-based default mount options which can be
117 specified with the -o option, mount_option_string is
118 an arbitrary string with a maximum length of 63
119 bytes, which is stored in the superblock.
120
121 The ext4 file system driver will first apply the
122 bitmask-based default options, and then parse the
123 mount_option_string, before parsing the mount
124 options passed from the mount(8) program.
125
126 This superblock setting is only honored in 2.6.35+
127 kernels; and not at all by the ext2 and ext3 file
128 system drivers.
129
130 force_fsck
131 Set a flag in the filesystem superblock indicating
132 that errors have been found. This will force fsck
133 to run at the next mount.
134
135 test_fs
136 Set a flag in the filesystem superblock indicating
137 that it may be mounted using experimental kernel
138 code, such as the ext4dev filesystem.
139
140 ^test_fs
141 Clear the test_fs flag, indicating the filesystem
142 should only be mounted using production-level
143 filesystem code.
144
145 -f Force the tune2fs operation to complete even in the face of
146 errors. This option is useful when removing the has_journal
147 filesystem feature from a filesystem which has an external jour‐
148 nal (or is corrupted such that it appears to have an external
149 journal), but that external journal is not available. If the
150 filesystem appears to require journal replay, the -f flag must
151 be specified twice to proceed.
152
153 WARNING: Removing an external journal from a filesystem which
154 was not cleanly unmounted without first replaying the external
155 journal can result in severe data loss and filesystem corrup‐
156 tion.
157
158 -g group
159 Set the group which can use the reserved filesystem blocks. The
160 group parameter can be a numerical gid or a group name. If a
161 group name is given, it is converted to a numerical gid before
162 it is stored in the superblock.
163
164 -i interval-between-checks[d|m|w]
165 Adjust the maximal time between two filesystem checks. No suf‐
166 fix or d will interpret the number interval-between-checks as
167 days, m as months, and w as weeks. A value of zero will disable
168 the time-dependent checking.
169
170 There are pros and cons to disabling these periodic checks; see
171 the discussion under the -c (mount-count-dependent check) option
172 for details.
173
174 -I Change the inode size used by the file system. This requires
175 rewriting the inode table, so it requires that the file system
176 is checked for consistency first using e2fsck(8). This opera‐
177 tion can also take a while and the file system can be corrupted
178 and data lost if it is interrupted while in the middle of con‐
179 verting the file system.
180
181 -j Add an ext3 journal to the filesystem. If the -J option is not
182 specified, the default journal parameters will be used to create
183 an appropriately sized journal (given the size of the filesys‐
184 tem) stored within the filesystem. Note that you must be using
185 a kernel which has ext3 support in order to actually make use of
186 the journal.
187
188 If this option is used to create a journal on a mounted filesys‐
189 tem, an immutable file, .journal, will be created in the top-
190 level directory of the filesystem, as it is the only safe way to
191 create the journal inode while the filesystem is mounted. While
192 the ext3 journal is visible, it is not safe to delete it, or
193 modify it while the filesystem is mounted; for this reason the
194 file is marked immutable. While checking unmounted filesystems,
195 e2fsck(8) will automatically move .journal files to the invisi‐
196 ble, reserved journal inode. For all filesystems except for the
197 root filesystem, this should happen automatically and naturally
198 during the next reboot cycle. Since the root filesystem is
199 mounted read-only, e2fsck(8) must be run from a rescue floppy in
200 order to effect this transition.
201
202 On some distributions, such as Debian, if an initial ramdisk is
203 used, the initrd scripts will automatically convert an ext2 root
204 filesystem to ext3 if the /etc/fstab file specifies the ext3
205 filesystem for the root filesystem in order to avoid requiring
206 the use of a rescue floppy to add an ext3 journal to the root
207 filesystem.
208
209 -J journal-options
210 Override the default ext3 journal parameters. Journal options
211 are comma separated, and may take an argument using the equals
212 ('=') sign. The following journal options are supported:
213
214 size=journal-size
215 Create a journal stored in the filesystem of size
216 journal-size megabytes. The size of the journal
217 must be at least 1024 filesystem blocks (i.e., 1MB
218 if using 1k blocks, 4MB if using 4k blocks, etc.)
219 and may be no more than 10,240,000 filesystem
220 blocks. There must be enough free space in the
221 filesystem to create a journal of that size.
222
223 location=journal-location
224 Specify the location of the journal. The argument
225 journal-location can either be specified as a block
226 number, or if the number has a units suffix (e.g.,
227 'M', 'G', etc.) interpret it as the offset from the
228 beginning of the file system.
229
230 device=external-journal
231 Attach the filesystem to the journal block device
232 located on external-journal. The external journal
233 must have been already created using the command
234
235 mke2fs -O journal_dev external-journal
236
237 Note that external-journal must be formatted with
238 the same block size as filesystems which will be
239 using it. In addition, while there is support for
240 attaching multiple filesystems to a single external
241 journal, the Linux kernel and e2fsck(8) do not cur‐
242 rently support shared external journals yet.
243
244 Instead of specifying a device name directly, exter‐
245 nal-journal can also be specified by either
246 LABEL=label or UUID=UUID to locate the external
247 journal by either the volume label or UUID stored in
248 the ext2 superblock at the start of the journal.
249 Use dumpe2fs(8) to display a journal device's volume
250 label and UUID. See also the -L option of
251 tune2fs(8).
252
253 Only one of the size or device options can be given for a
254 filesystem.
255
256 -l List the contents of the filesystem superblock, including the
257 current values of the parameters that can be set via this pro‐
258 gram.
259
260 -L volume-label
261 Set the volume label of the filesystem. Ext2 filesystem labels
262 can be at most 16 characters long; if volume-label is longer
263 than 16 characters, tune2fs will truncate it and print a warn‐
264 ing. The volume label can be used by mount(8), fsck(8), and
265 /etc/fstab(5) (and possibly others) by specifying LABEL=volume-
266 label instead of a block special device name like /dev/hda5.
267
268 -m reserved-blocks-percentage
269 Set the percentage of the filesystem which may only be allocated
270 by privileged processes. Reserving some number of filesystem
271 blocks for use by privileged processes is done to avoid filesys‐
272 tem fragmentation, and to allow system daemons, such as sys‐
273 logd(8), to continue to function correctly after non-privileged
274 processes are prevented from writing to the filesystem. Nor‐
275 mally, the default percentage of reserved blocks is 5%.
276
277 -M last-mounted-directory
278 Set the last-mounted directory for the filesystem.
279
280 -o [^]mount-option[,...]
281 Set or clear the indicated default mount options in the filesys‐
282 tem. Default mount options can be overridden by mount options
283 specified either in /etc/fstab(5) or on the command line argu‐
284 ments to mount(8). Older kernels may not support this feature;
285 in particular, kernels which predate 2.4.20 will almost cer‐
286 tainly ignore the default mount options field in the superblock.
287
288 More than one mount option can be cleared or set by separating
289 features with commas. Mount options prefixed with a caret char‐
290 acter ('^') will be cleared in the filesystem's superblock;
291 mount options without a prefix character or prefixed with a plus
292 character ('+') will be added to the filesystem.
293
294 The following mount options can be set or cleared using tune2fs:
295
296 debug Enable debugging code for this filesystem.
297
298 bsdgroups
299 Emulate BSD behavior when creating new files: they
300 will take the group-id of the directory in which
301 they were created. The standard System V behavior
302 is the default, where newly created files take on
303 the fsgid of the current process, unless the direc‐
304 tory has the setgid bit set, in which case it takes
305 the gid from the parent directory, and also gets the
306 setgid bit set if it is a directory itself.
307
308 user_xattr
309 Enable user-specified extended attributes.
310
311 acl Enable Posix Access Control Lists.
312
313 uid16 Disables 32-bit UIDs and GIDs. This is for interop‐
314 erability with older kernels which only store and
315 expect 16-bit values.
316
317 journal_data
318 When the filesystem is mounted with journalling
319 enabled, all data (not just metadata) is committed
320 into the journal prior to being written into the
321 main filesystem.
322
323 journal_data_ordered
324 When the filesystem is mounted with journalling
325 enabled, all data is forced directly out to the main
326 file system prior to its metadata being committed to
327 the journal.
328
329 journal_data_writeback
330 When the filesystem is mounted with journalling
331 enabled, data may be written into the main filesys‐
332 tem after its metadata has been committed to the
333 journal. This may increase throughput, however, it
334 may allow old data to appear in files after a crash
335 and journal recovery.
336
337 nobarrier
338 The file system will be mounted with barrier opera‐
339 tions in the journal disabled. (This option is cur‐
340 rently only supported by the ext4 file system driver
341 in 2.6.35+ kernels.)
342
343 block_validity
344 The file system will be mounted with the
345 block_validity option enabled, which causes extra
346 checks to be performed after reading or writing from
347 the file system. This prevents corrupted metadata
348 blocks from causing file system damage by overwrit‐
349 ing parts of the inode table or block group descrip‐
350 tors. This comes at the cost of increased memory
351 and CPU overhead, so it is enabled only for debug‐
352 ging purposes. (This option is currently only sup‐
353 ported by the ext4 file system driver in 2.6.35+
354 kernels.)
355
356 discard
357 The file system will be mounted with the discard
358 mount option. This will cause the file system
359 driver to attempt to use the trim/discard feature of
360 some storage devices (such as SSD's and thin-provi‐
361 sioned drives available in some enterprise storage
362 arrays) to inform the storage device that blocks
363 belonging to deleted files can be reused for other
364 purposes. (This option is currently only supported
365 by the ext4 file system driver in 2.6.35+ kernels.)
366
367 nodelalloc
368 The file system will be mounted with the nodelalloc
369 mount option. This will disable the delayed alloca‐
370 tion feature. (This option is currently only sup‐
371 ported by the ext4 file system driver in 2.6.35+
372 kernels.)
373
374 -O [^]feature[,...]
375 Set or clear the indicated filesystem features (options) in the
376 filesystem. More than one filesystem feature can be cleared or
377 set by separating features with commas. Filesystem features
378 prefixed with a caret character ('^') will be cleared in the
379 filesystem's superblock; filesystem features without a prefix
380 character or prefixed with a plus character ('+') will be added
381 to the filesystem. For a detailed description of the file sys‐
382 tem features, please see the man page ext4(5).
383
384 The following filesystem features can be set or cleared using
385 tune2fs:
386
387 64bit Enable the file system to be larger than 2^32
388 blocks.
389
390 dir_index
391 Use hashed b-trees to speed up lookups for large
392 directories.
393
394 dir_nlink
395 Allow more than 65000 subdirectories per directory.
396
397 ea_inode
398 Allow the value of each extended attribute to be
399 placed in the data blocks of a separate inode if
400 necessary, increasing the limit on the size and num‐
401 ber of extended attributes per file. Tune2fs cur‐
402 rently only supports setting this filesystem fea‐
403 ture.
404
405 encrypt
406 Enable support for file system level encryption.
407 Tune2fs currently only supports setting this
408 filesystem feature.
409
410 extent Enable the use of extent trees to store the location
411 of data blocks in inodes. Tune2fs currently only
412 supports setting this filesystem feature.
413
414 extra_isize
415 Enable the extended inode fields used by ext4.
416
417 filetype
418 Store file type information in directory entries.
419
420 flex_bg
421 Allow bitmaps and inode tables for a block group to
422 be placed anywhere on the storage media. Tune2fs
423 will not reorganize the location of the inode tables
424 and allocation bitmaps, as mke2fs(8) will do when it
425 creates a freshly formatted file system with flex_bg
426 enabled.
427
428 has_journal
429 Use a journal to ensure filesystem consistency even
430 across unclean shutdowns. Setting the filesystem
431 feature is equivalent to using the -j option.
432
433 large_dir
434 Increase the limit on the number of files per direc‐
435 tory. Tune2fs currently only supports setting this
436 filesystem feature.
437
438 huge_file
439 Support files larger than 2 terabytes in size.
440
441 large_file
442 Filesystem can contain files that are greater than
443 2GB.
444
445 metadata_csum
446 Store a checksum to protect the contents in each
447 metadata block.
448
449 metadata_csum_seed
450 Allow the filesystem to store the metadata checksum
451 seed in the superblock, enabling the administrator
452 to change the UUID of a filesystem using the meta‐
453 data_csum feature while it is mounted.
454
455 mmp Enable or disable multiple mount protection (MMP)
456 feature.
457
458 project
459 Enable project ID tracking. This is used for
460 project quota tracking.
461
462 quota Enable internal file system quota inodes.
463
464 read-only
465 Force the kernel to mount the file system read-only.
466
467 resize_inode
468 Reserve space so the block group descriptor table
469 may grow in the future. Tune2fs only supports
470 clearing this filesystem feature.
471
472 sparse_super
473 Limit the number of backup superblocks to save space
474 on large filesystems. Tune2fs currently only sup‐
475 ports setting this filesystem feature.
476
477 uninit_bg
478 Allow the kernel to initialize bitmaps and inode
479 tables lazily, and to keep a high watermark for the
480 unused inodes in a filesystem, to reduce e2fsck(8)
481 time. The first e2fsck run after enabling this fea‐
482 ture will take the full time, but subsequent e2fsck
483 runs will take only a fraction of the original time,
484 depending on how full the file system is.
485
486 verity Enable support for verity protected files. Tune2fs
487 currently only supports setting this filesystem fea‐
488 ture.
489
490 After setting or clearing sparse_super, uninit_bg, filetype, or
491 resize_inode filesystem features, the file system may require
492 being checked using e2fsck(8) to return the filesystem to a con‐
493 sistent state. Tune2fs will print a message requesting that the
494 system administrator run e2fsck(8) if necessary. After setting
495 the dir_index feature, e2fsck -D can be run to convert existing
496 directories to the hashed B-tree format. Enabling certain
497 filesystem features may prevent the filesystem from being
498 mounted by kernels which do not support those features. In par‐
499 ticular, the uninit_bg and flex_bg features are only supported
500 by the ext4 filesystem.
501
502 -r reserved-blocks-count
503 Set the number of reserved filesystem blocks.
504
505 -Q quota-options
506 Sets 'quota' feature on the superblock and works on the quota
507 files for the given quota type. Quota options could be one or
508 more of the following:
509
510 [^]usrquota
511 Sets/clears user quota inode in the superblock.
512
513 [^]grpquota
514 Sets/clears group quota inode in the superblock.
515
516 [^]prjquota
517 Sets/clears project quota inode in the superblock.
518
519 -T time-last-checked
520 Set the time the filesystem was last checked using e2fsck. The
521 time is interpreted using the current (local) timezone. This
522 can be useful in scripts which use a Logical Volume Manager to
523 make a consistent snapshot of a filesystem, and then check the
524 filesystem during off hours to make sure it hasn't been cor‐
525 rupted due to hardware problems, etc. If the filesystem was
526 clean, then this option can be used to set the last checked time
527 on the original filesystem. The format of time-last-checked is
528 the international date format, with an optional time specifier,
529 i.e. YYYYMMDD[HH[MM[SS]]]. The keyword now is also accepted,
530 in which case the last checked time will be set to the current
531 time.
532
533 -u user
534 Set the user who can use the reserved filesystem blocks. user
535 can be a numerical uid or a user name. If a user name is given,
536 it is converted to a numerical uid before it is stored in the
537 superblock.
538
539 -U UUID
540 Set the universally unique identifier (UUID) of the filesystem
541 to UUID. The format of the UUID is a series of hex digits sepa‐
542 rated by hyphens, like this:
543 "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may
544 also be one of the following:
545
546 clear clear the filesystem UUID
547
548 random generate a new randomly-generated UUID
549
550 time generate a new time-based UUID
551
552 The UUID may be used by mount(8), fsck(8), and /etc/fstab(5)
553 (and possibly others) by specifying UUID=uuid instead of a block
554 special device name like /dev/hda1.
555
556 See uuidgen(8) for more information. If the system does not
557 have a good random number generator such as /dev/random or
558 /dev/urandom, tune2fs will automatically use a time-based UUID
559 instead of a randomly-generated UUID.
560
561 -z undo_file
562 Before overwriting a file system block, write the old contents
563 of the block to an undo file. This undo file can be used with
564 e2undo(8) to restore the old contents of the file system should
565 something go wrong. If the empty string is passed as the
566 undo_file argument, the undo file will be written to a file
567 named tune2fs-device.e2undo in the directory specified via the
568 E2FSPROGS_UNDO_DIR environment variable.
569
570 WARNING: The undo file cannot be used to recover from a power or
571 system crash.
572
574 We haven't found any bugs yet. That doesn't mean there aren't any...
575
577 tune2fs was written by Remy Card <Remy.Card@linux.org>. It is cur‐
578 rently being maintained by Theodore Ts'o <tytso@alum.mit.edu>. tune2fs
579 uses the ext2fs library written by Theodore Ts'o <tytso@mit.edu>. This
580 manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>.
581 Time-dependent checking was added by Uwe Ohse <uwe@tirka.gun.de>.
582
584 tune2fs is part of the e2fsprogs package and is available from
585 http://e2fsprogs.sourceforge.net.
586
588 debugfs(8), dumpe2fs(8), e2fsck(8), mke2fs(8), ext4(5)
589
590
591
592E2fsprogs version 1.45.5 January 2020 TUNE2FS(8)