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