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