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