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. Backing up the file system before
180 changing inode size is recommended.
181
182 File systems with an inode size of 128 bytes do not support
183 timestamps beyond January 19, 2038. Inodes which are 256 bytes
184 or larger will support extended timestamps, project id's, and
185 the ability to store some extended attributes in the inode table
186 for improved performance.
187
188 -j Add an ext3 journal to the filesystem. If the -J option is not
189 specified, the default journal parameters will be used to create
190 an appropriately sized journal (given the size of the filesys‐
191 tem) stored within the filesystem. Note that you must be using
192 a kernel which has ext3 support in order to actually make use of
193 the journal.
194
195 If this option is used to create a journal on a mounted filesys‐
196 tem, an immutable file, .journal, will be created in the top-
197 level directory of the filesystem, as it is the only safe way to
198 create the journal inode while the filesystem is mounted. While
199 the ext3 journal is visible, it is not safe to delete it, or
200 modify it while the filesystem is mounted; for this reason the
201 file is marked immutable. While checking unmounted filesystems,
202 e2fsck(8) will automatically move .journal files to the invisi‐
203 ble, reserved journal inode. For all filesystems except for the
204 root filesystem, this should happen automatically and naturally
205 during the next reboot cycle. Since the root filesystem is
206 mounted read-only, e2fsck(8) must be run from a rescue floppy in
207 order to effect this transition.
208
209 On some distributions, such as Debian, if an initial ramdisk is
210 used, the initrd scripts will automatically convert an ext2 root
211 filesystem to ext3 if the /etc/fstab file specifies the ext3
212 filesystem for the root filesystem in order to avoid requiring
213 the use of a rescue floppy to add an ext3 journal to the root
214 filesystem.
215
216 -J journal-options
217 Override the default ext3 journal parameters. Journal options
218 are comma separated, and may take an argument using the equals
219 ('=') sign. The following journal options are supported:
220
221 size=journal-size
222 Create a journal stored in the filesystem of size
223 journal-size megabytes. The size of the journal
224 must be at least 1024 filesystem blocks (i.e., 1MB
225 if using 1k blocks, 4MB if using 4k blocks, etc.)
226 and may be no more than 10,240,000 filesystem
227 blocks. There must be enough free space in the
228 filesystem to create a journal of that size.
229
230 location=journal-location
231 Specify the location of the journal. The argument
232 journal-location can either be specified as a block
233 number, or if the number has a units suffix (e.g.,
234 'M', 'G', etc.) interpret it as the offset from the
235 beginning of the file system.
236
237 device=external-journal
238 Attach the filesystem to the journal block device
239 located on external-journal. The external journal
240 must have been already created using the command
241
242 mke2fs -O journal_dev external-journal
243
244 Note that external-journal must be formatted with
245 the same block size as filesystems which will be
246 using it. In addition, while there is support for
247 attaching multiple filesystems to a single external
248 journal, the Linux kernel and e2fsck(8) do not cur‐
249 rently support shared external journals yet.
250
251 Instead of specifying a device name directly, exter‐
252 nal-journal can also be specified by either
253 LABEL=label or UUID=UUID to locate the external
254 journal by either the volume label or UUID stored in
255 the ext2 superblock at the start of the journal.
256 Use dumpe2fs(8) to display a journal device's volume
257 label and UUID. See also the -L option of
258 tune2fs(8).
259
260 Only one of the size or device options can be given for a
261 filesystem.
262
263 -l List the contents of the filesystem superblock, including the
264 current values of the parameters that can be set via this pro‐
265 gram.
266
267 -L volume-label
268 Set the volume label of the filesystem. Ext2 filesystem labels
269 can be at most 16 characters long; if volume-label is longer
270 than 16 characters, tune2fs will truncate it and print a warn‐
271 ing. The volume label can be used by mount(8), fsck(8), and
272 /etc/fstab(5) (and possibly others) by specifying LABEL=volume-
273 label instead of a block special device name like /dev/hda5.
274
275 -m reserved-blocks-percentage
276 Set the percentage of the filesystem which may only be allocated
277 by privileged processes. Reserving some number of filesystem
278 blocks for use by privileged processes is done to avoid filesys‐
279 tem fragmentation, and to allow system daemons, such as sys‐
280 logd(8), to continue to function correctly after non-privileged
281 processes are prevented from writing to the filesystem. Nor‐
282 mally, the default percentage of reserved blocks is 5%.
283
284 -M last-mounted-directory
285 Set the last-mounted directory for the filesystem.
286
287 -o [^]mount-option[,...]
288 Set or clear the indicated default mount options in the filesys‐
289 tem. Default mount options can be overridden by mount options
290 specified either in /etc/fstab(5) or on the command line argu‐
291 ments to mount(8). Older kernels may not support this feature;
292 in particular, kernels which predate 2.4.20 will almost cer‐
293 tainly ignore the default mount options field in the superblock.
294
295 More than one mount option can be cleared or set by separating
296 features with commas. Mount options prefixed with a caret char‐
297 acter ('^') will be cleared in the filesystem's superblock;
298 mount options without a prefix character or prefixed with a plus
299 character ('+') will be added to the filesystem.
300
301 The following mount options can be set or cleared using tune2fs:
302
303 debug Enable debugging code for this filesystem.
304
305 bsdgroups
306 Emulate BSD behavior when creating new files: they
307 will take the group-id of the directory in which
308 they were created. The standard System V behavior
309 is the default, where newly created files take on
310 the fsgid of the current process, unless the direc‐
311 tory has the setgid bit set, in which case it takes
312 the gid from the parent directory, and also gets the
313 setgid bit set if it is a directory itself.
314
315 user_xattr
316 Enable user-specified extended attributes.
317
318 acl Enable Posix Access Control Lists.
319
320 uid16 Disables 32-bit UIDs and GIDs. This is for interop‐
321 erability with older kernels which only store and
322 expect 16-bit values.
323
324 journal_data
325 When the filesystem is mounted with journalling
326 enabled, all data (not just metadata) is committed
327 into the journal prior to being written into the
328 main filesystem.
329
330 journal_data_ordered
331 When the filesystem is mounted with journalling
332 enabled, all data is forced directly out to the main
333 file system prior to its metadata being committed to
334 the journal.
335
336 journal_data_writeback
337 When the filesystem is mounted with journalling
338 enabled, data may be written into the main filesys‐
339 tem after its metadata has been committed to the
340 journal. This may increase throughput, however, it
341 may allow old data to appear in files after a crash
342 and journal recovery.
343
344 nobarrier
345 The file system will be mounted with barrier opera‐
346 tions in the journal disabled. (This option is cur‐
347 rently only supported by the ext4 file system driver
348 in 2.6.35+ kernels.)
349
350 block_validity
351 The file system will be mounted with the
352 block_validity option enabled, which causes extra
353 checks to be performed after reading or writing from
354 the file system. This prevents corrupted metadata
355 blocks from causing file system damage by overwrit‐
356 ing parts of the inode table or block group descrip‐
357 tors. This comes at the cost of increased memory
358 and CPU overhead, so it is enabled only for debug‐
359 ging purposes. (This option is currently only sup‐
360 ported by the ext4 file system driver in 2.6.35+
361 kernels.)
362
363 discard
364 The file system will be mounted with the discard
365 mount option. This will cause the file system
366 driver to attempt to use the trim/discard feature of
367 some storage devices (such as SSD's and thin-provi‐
368 sioned drives available in some enterprise storage
369 arrays) to inform the storage device that blocks
370 belonging to deleted files can be reused for other
371 purposes. (This option is currently only supported
372 by the ext4 file system driver in 2.6.35+ kernels.)
373
374 nodelalloc
375 The file system will be mounted with the nodelalloc
376 mount option. This will disable the delayed alloca‐
377 tion feature. (This option is currently only sup‐
378 ported by the ext4 file system driver in 2.6.35+
379 kernels.)
380
381 -O [^]feature[,...]
382 Set or clear the indicated filesystem features (options) in the
383 filesystem. More than one filesystem feature can be cleared or
384 set by separating features with commas. Filesystem features
385 prefixed with a caret character ('^') will be cleared in the
386 filesystem's superblock; filesystem features without a prefix
387 character or prefixed with a plus character ('+') will be added
388 to the filesystem. For a detailed description of the file sys‐
389 tem features, please see the man page ext4(5).
390
391 The following filesystem features can be set or cleared using
392 tune2fs:
393
394 64bit Enable the file system to be larger than 2^32
395 blocks.
396
397 dir_index
398 Use hashed b-trees to speed up lookups for large
399 directories.
400
401 dir_nlink
402 Allow more than 65000 subdirectories per directory.
403
404 ea_inode
405 Allow the value of each extended attribute to be
406 placed in the data blocks of a separate inode if
407 necessary, increasing the limit on the size and num‐
408 ber of extended attributes per file. Tune2fs cur‐
409 rently only supports setting this filesystem fea‐
410 ture.
411
412 encrypt
413 Enable support for file system level encryption.
414 Tune2fs currently only supports setting this
415 filesystem feature.
416
417 extent Enable the use of extent trees to store the location
418 of data blocks in inodes. Tune2fs currently only
419 supports setting this filesystem feature.
420
421 extra_isize
422 Enable the extended inode fields used by ext4.
423
424 filetype
425 Store file type information in directory entries.
426
427 flex_bg
428 Allow bitmaps and inode tables for a block group to
429 be placed anywhere on the storage media. Tune2fs
430 will not reorganize the location of the inode tables
431 and allocation bitmaps, as mke2fs(8) will do when it
432 creates a freshly formatted file system with flex_bg
433 enabled.
434
435 has_journal
436 Use a journal to ensure filesystem consistency even
437 across unclean shutdowns. Setting the filesystem
438 feature is equivalent to using the -j option.
439
440 large_dir
441 Increase the limit on the number of files per direc‐
442 tory. Tune2fs currently only supports setting this
443 filesystem feature.
444
445 huge_file
446 Support files larger than 2 terabytes in size.
447
448 large_file
449 Filesystem can contain files that are greater than
450 2GB.
451
452 metadata_csum
453 Store a checksum to protect the contents in each
454 metadata block.
455
456 metadata_csum_seed
457 Allow the filesystem to store the metadata checksum
458 seed in the superblock, enabling the administrator
459 to change the UUID of a filesystem using the meta‐
460 data_csum feature while it is mounted.
461
462 mmp Enable or disable multiple mount protection (MMP)
463 feature.
464
465 project
466 Enable project ID tracking. This is used for
467 project quota tracking.
468
469 quota Enable internal file system quota inodes.
470
471 read-only
472 Force the kernel to mount the file system read-only.
473
474 resize_inode
475 Reserve space so the block group descriptor table
476 may grow in the future. Tune2fs only supports
477 clearing this filesystem feature.
478
479 sparse_super
480 Limit the number of backup superblocks to save space
481 on large filesystems. Tune2fs currently only sup‐
482 ports setting this filesystem feature.
483
484 uninit_bg
485 Allow the kernel to initialize bitmaps and inode
486 tables lazily, and to keep a high watermark for the
487 unused inodes in a filesystem, to reduce e2fsck(8)
488 time. The first e2fsck run after enabling this fea‐
489 ture will take the full time, but subsequent e2fsck
490 runs will take only a fraction of the original time,
491 depending on how full the file system is.
492
493 verity Enable support for verity protected files. Tune2fs
494 currently only supports setting this filesystem fea‐
495 ture.
496
497 After setting or clearing sparse_super, uninit_bg, filetype, or
498 resize_inode filesystem features, the file system may require
499 being checked using e2fsck(8) to return the filesystem to a con‐
500 sistent state. Tune2fs will print a message requesting that the
501 system administrator run e2fsck(8) if necessary. After setting
502 the dir_index feature, e2fsck -D can be run to convert existing
503 directories to the hashed B-tree format. Enabling certain
504 filesystem features may prevent the filesystem from being
505 mounted by kernels which do not support those features. In par‐
506 ticular, the uninit_bg and flex_bg features are only supported
507 by the ext4 filesystem.
508
509 -r reserved-blocks-count
510 Set the number of reserved filesystem blocks.
511
512 -Q quota-options
513 Sets 'quota' feature on the superblock and works on the quota
514 files for the given quota type. Quota options could be one or
515 more of the following:
516
517 [^]usrquota
518 Sets/clears user quota inode in the superblock.
519
520 [^]grpquota
521 Sets/clears group quota inode in the superblock.
522
523 [^]prjquota
524 Sets/clears project quota inode in the superblock.
525
526 -T time-last-checked
527 Set the time the filesystem was last checked using e2fsck. The
528 time is interpreted using the current (local) timezone. This
529 can be useful in scripts which use a Logical Volume Manager to
530 make a consistent snapshot of a filesystem, and then check the
531 filesystem during off hours to make sure it hasn't been cor‐
532 rupted due to hardware problems, etc. If the filesystem was
533 clean, then this option can be used to set the last checked time
534 on the original filesystem. The format of time-last-checked is
535 the international date format, with an optional time specifier,
536 i.e. YYYYMMDD[HH[MM[SS]]]. The keyword now is also accepted,
537 in which case the last checked time will be set to the current
538 time.
539
540 -u user
541 Set the user who can use the reserved filesystem blocks. user
542 can be a numerical uid or a user name. If a user name is given,
543 it is converted to a numerical uid before it is stored in the
544 superblock.
545
546 -U UUID
547 Set the universally unique identifier (UUID) of the filesystem
548 to UUID. The format of the UUID is a series of hex digits sepa‐
549 rated by hyphens, like this:
550 "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may
551 also be one of the following:
552
553 clear clear the filesystem UUID
554
555 random generate a new randomly-generated UUID
556
557 time generate a new time-based UUID
558
559 The UUID may be used by mount(8), fsck(8), and /etc/fstab(5)
560 (and possibly others) by specifying UUID=uuid instead of a block
561 special device name like /dev/hda1.
562
563 See uuidgen(8) for more information. If the system does not
564 have a good random number generator such as /dev/random or
565 /dev/urandom, tune2fs will automatically use a time-based UUID
566 instead of a randomly-generated UUID.
567
568 -z undo_file
569 Before overwriting a file system block, write the old contents
570 of the block to an undo file. This undo file can be used with
571 e2undo(8) to restore the old contents of the file system should
572 something go wrong. If the empty string is passed as the
573 undo_file argument, the undo file will be written to a file
574 named tune2fs-device.e2undo in the directory specified via the
575 E2FSPROGS_UNDO_DIR environment variable.
576
577 WARNING: The undo file cannot be used to recover from a power or
578 system crash.
579
581 We haven't found any bugs yet. That doesn't mean there aren't any...
582
584 tune2fs was written by Remy Card <Remy.Card@linux.org>. It is cur‐
585 rently being maintained by Theodore Ts'o <tytso@alum.mit.edu>. tune2fs
586 uses the ext2fs library written by Theodore Ts'o <tytso@mit.edu>. This
587 manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>.
588 Time-dependent checking was added by Uwe Ohse <uwe@tirka.gun.de>.
589
591 tune2fs is part of the e2fsprogs package and is available from
592 http://e2fsprogs.sourceforge.net.
593
595 debugfs(8), dumpe2fs(8), e2fsck(8), mke2fs(8), ext4(5)
596
597
598
599E2fsprogs version 1.45.6 March 2020 TUNE2FS(8)