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