OSDN Git Service

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