OSDN Git Service

Make ext2 utils available to all builds
[android-x86/external-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 .B test_fs
191 Set a flag in the filesystem superblock indicating that it may be
192 mounted using experimental kernel code, such as the ext4dev filesystem.
193 .TP
194 .B ^test_fs
195 Clear the test_fs flag, indicating the filesystem should only be mounted
196 using production-level filesystem code.
197 .RE
198 .TP
199 .B \-f
200 Force the tune2fs operation to complete even in the face of errors.  This 
201 option is useful when removing the 
202 .B has_journal
203 filesystem feature from a filesystem which has 
204 an external journal (or is corrupted
205 such that it appears to have an external journal), but that 
206 external journal is not available.   
207 .sp
208 .B WARNING:
209 Removing an external journal from a filesystem which was not cleanly unmounted
210 without first replaying the external journal can result in
211 severe data loss and filesystem corruption.
212 .TP
213 .BI \-g " group"
214 Set the group which can use the reserved filesystem blocks.
215 The 
216 .I group
217 parameter can be a numerical gid or a group name.  If a group name is given,
218 it is converted to a numerical gid before it is stored in the superblock.
219 .TP
220 .B \-i " \fIinterval-between-checks\fR[\fBd\fR|\fBm\fR|\fBw\fR]"
221 Adjust the maximal time between two filesystem checks. 
222 No suffix or
223 .B d
224 will interpret the number
225 .I interval-between-checks
226 as days,
227 .B m
228 as months, and
229 .B w
230 as weeks.  A value of zero will disable the time-dependent checking.
231 .sp
232 It is strongly recommended that either
233 .B \-c
234 (mount-count-dependent) or
235 .B \-i
236 (time-dependent) checking be enabled to force periodic full
237 .BR e2fsck (8)
238 checking of the filesystem.  Failure to do so may lead to filesystem
239 corruption (due to bad disks, cables, memory, or kernel bugs) going
240 unnoticed, ultimately resulting in data loss or corruption.
241 .TP
242 .B \-j
243 Add an ext3 journal to the filesystem.  If the 
244 .B \-J
245 option is not specified, the default journal parameters will be used to create
246 an appropriately sized journal (given the size of the filesystem) 
247 stored within the filesystem.  Note that you must be using a kernel
248 which has ext3 support in order to actually make use of the journal.
249 .IP
250 If this option is used to create a journal on a mounted filesystem, an
251 immutable file,
252 .BR .journal ,
253 will be created in the top-level directory of the filesystem, as it is
254 the only safe way to create the journal inode while the filesystem is
255 mounted.  While the ext3 journal is visible, it is not safe to
256 delete it, or modify it while the filesystem is mounted; for this
257 reason the file is marked immutable.
258 While checking unmounted filesystems, 
259 .BR e2fsck (8)
260 will automatically move 
261 .B .journal
262 files to the invisible, reserved journal inode.  For all filesystems
263 except for the root filesystem,  this should happen automatically and
264 naturally during the next reboot cycle.  Since the root filesystem is
265 mounted read-only,
266 .BR e2fsck (8)
267 must be run from a rescue floppy in order to effect this transition.
268 .IP
269 On some distributions, such as Debian, if an initial ramdisk is used,
270 the initrd scripts will automatically convert an ext2 root filesystem
271 to ext3 if the  
272 .BR /etc/fstab
273 file specifies the ext3 filesystem for the root filesystem in order to
274 avoid requiring the use of a rescue floppy to add an ext3 journal to
275 the root filesystem.
276 .TP
277 .BR \-J " journal-options"
278 Override the default ext3 journal parameters. Journal options are comma
279 separated, and may take an argument using the equals ('=')  sign.
280 The following journal options are supported:
281 .RS 1.2i
282 .TP
283 .BI size= journal-size
284 Create a journal stored in the filesystem of size
285 .I journal-size
286 megabytes.   The size of the journal must be at least 1024 filesystem blocks
287 (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.)
288 and may be no more than 102,400 filesystem blocks.
289 There must be enough free space in the filesystem to create a journal of
290 that size.
291 @JDEV@.TP
292 @JDEV@.BI device= external-journal
293 @JDEV@Attach the filesystem to the journal block device located on
294 @JDEV@.IR external-journal .
295 @JDEV@The external 
296 @JDEV@journal must have been already created using the command
297 @JDEV@.IP
298 @JDEV@.B mke2fs -O journal_dev 
299 @JDEV@.I external-journal
300 @JDEV@.IP
301 @JDEV@Note that
302 @JDEV@.I external-journal
303 @JDEV@must be formatted with the same block
304 @JDEV@size as filesystems which will be using it.
305 @JDEV@In addition, while there is support for attaching
306 @JDEV@multiple filesystems to a single external journal,
307 @JDEV@the Linux kernel and 
308 @JDEV@.BR e2fsck (8)
309 @JDEV@do not currently support shared external journals yet.
310 @JDEV@.IP
311 @JDEV@Instead of specifying a device name directly,
312 @JDEV@.I external-journal
313 @JDEV@can also be specified by either
314 @JDEV@.BI LABEL= label
315 @JDEV@or
316 @JDEV@.BI UUID= UUID
317 @JDEV@to locate the external journal by either the volume label or UUID
318 @JDEV@stored in the ext2 superblock at the start of the journal.  Use
319 @JDEV@.BR dumpe2fs (8)
320 @JDEV@to display a journal device's volume label and UUID.  See also the
321 @JDEV@.B -L
322 @JDEV@option of
323 @JDEV@.BR tune2fs (8).
324 .RE
325 @JDEV@.IP
326 @JDEV@Only one of the
327 @JDEV@.BR size " or " device
328 @JDEV@options can be given for a filesystem.
329 .TP
330 .B \-l
331 List the contents of the filesystem superblock, including the current
332 values of the parameters that can be set via this program.
333 .TP
334 .BI \-L " volume-label"
335 Set the volume label of the filesystem.  
336 Ext2 filesystem labels can be at most 16 characters long; if
337 .I volume-label 
338 is longer than 16 characters, 
339 .B tune2fs
340 will truncate it and print a warning.  The volume label can be used
341 by
342 .BR mount (8),
343 .BR fsck (8),
344 and
345 .BR /etc/fstab (5)
346 (and possibly others) by specifying
347 .BI LABEL= volume_label
348 instead of a block special device name like
349 .BR /dev/hda5 .
350 .TP
351 .BI \-m " reserved-blocks-percentage"
352 Set the percentage of the filesystem which may only be allocated
353 by privileged processes.   Reserving some number of filesystem blocks 
354 for use by privileged processes is done 
355 to avoid filesystem fragmentation, and to allow system
356 daemons, such as 
357 .BR syslogd (8),
358 to continue to function correctly after non-privileged processes are 
359 prevented from writing to the filesystem.  Normally, the default percentage 
360 of reserved blocks is 5%.
361 .TP
362 .BI \-M " last-mounted-directory"
363 Set the last-mounted directory for the filesystem.
364 .TP
365 .BR \-o " [^]\fImount-option\fR[,...]"
366 Set or clear the indicated default mount options in the filesystem.
367 Default mount options can be overridden by mount options specified 
368 either in 
369 .BR /etc/fstab (5)
370 or on the command line arguments to
371 .BR mount (8).   
372 Older kernels may not support this feature; in particular,
373 kernels which predate 2.4.20 will almost certainly ignore the
374 default mount options field in the superblock.
375 .IP
376 More than one mount option can be cleared or set by separating
377 features with commas.  Mount options prefixed with a 
378 caret character ('^') will be cleared in the filesystem's superblock; 
379 mount options without a prefix character or prefixed with a plus 
380 character ('+') will be added to the filesystem.
381 .IP
382 The following mount options can be set or cleared using
383 .BR tune2fs :
384 .RS 1.2i
385 .TP
386 .B debug
387 Enable debugging code for this filesystem.
388 .TP
389 .B bsdgroups
390 Emulate BSD behaviour when creating new files: they will take the group-id
391 of the directory in which they were created.  The standard System V behaviour
392 is the default, where newly created files take on the fsgid of the current
393 process, unless the directory has the setgid bit set, in which case it takes 
394 the gid from the parent directory, and also gets the setgid bit set if it is 
395 a directory itself.
396 .TP
397 .B user_xattr
398 Enable user-specified extended attributes.
399 .TP
400 .B acl
401 Enable Posix Access Control Lists.
402 .TP
403 .B uid16
404 Disables 32-bit UIDs and GIDs.  This is for interoperability with
405 older kernels which only store and expect 16-bit values.
406 .TP
407 .B journal_data
408 When the filesystem is mounted with journalling enabled, all data
409 (not just metadata) is committed into the journal prior to being written
410 into the main filesystem.
411 .TP
412 .B journal_data_ordered
413 When the filesystem is mounted with journalling enabled, all data is forced
414 directly out to the main file system prior to its metadata being committed 
415 to the journal.
416 .TP
417 .B journal_data_writeback
418 When the filesystem is mounted with journalling enabled, data may be
419 written into the main filesystem after its metadata has been committed
420 to the journal.  This may increase throughput, however, it may allow old
421 data to appear in files after a crash and journal recovery.
422 .RE
423 .TP
424 .BR \-O " [^]\fIfeature\fR[,...]"
425 Set or clear the indicated filesystem features (options) in the filesystem.
426 More than one filesystem feature can be cleared or set by separating
427 features with commas.  Filesystem features prefixed with a 
428 caret character ('^') will be cleared in the filesystem's superblock; 
429 filesystem features without a prefix character or prefixed with a plus 
430 character ('+') will be added to the filesystem.
431 .IP
432 The following filesystem features can be set or cleared using
433 .BR tune2fs :
434 .RS 1.2i
435 .TP
436 .B dir_index
437 Use hashed b-trees to speed up lookups in large directories.
438 .TP
439 .B filetype
440 Store file type information in directory entries.
441 .TP
442 .B flex_bg
443 Allow bitmaps and inode tables for a block group to be placed
444 anywhere on the storage media.  \fBTune2fs\fR will not reorganize
445 the location of the inode tables and allocation bitmaps, as
446 .BR mke2fs (8)
447 will do when it creates a freshly formated file system with
448 .B flex_bg
449 enabled.
450 .TP
451 .B has_journal
452 Use a journal to ensure filesystem consistency even across unclean shutdowns.
453 Setting the filesystem feature is equivalent to using the 
454 .B \-j
455 option.
456 .TP
457 .B large_file
458 Filesystem can contain files that are greater than 2GB.  (Modern kernels
459 set this feature automatically when a file > 2GB is created.)
460 .TP
461 .B resize_inode
462 Reserve space so the block group descriptor table may grow in the
463 future.
464 .B Tune2fs 
465 only supports clearing this filesystem feature.
466 .TP
467 .B sparse_super
468 Limit the number of backup superblocks to save space on large filesystems.
469 .TP
470 .B uninit_bg
471 Allow the kernel to initialize bitmaps and inode tables and keep a high
472 watermark for the unused inodes in a filesystem, to reduce
473 .BR e2fsck (8)
474 time.  This first e2fsck run after enabling this feature will take the
475 full time, but subsequent e2fsck runs will take only a fraction of the
476 original time, depending on how full the file system is.
477 .RE
478 .IP
479 After setting or clearing 
480 .BR sparse_super ,
481 .BR uninit_bg ,
482 .BR filetype ,
483 or
484 .B resize_inode
485 filesystem features,
486 .BR e2fsck (8)
487 must be run on the filesystem to return the filesystem to a consistent state.
488 .B Tune2fs
489 will print a message requesting that the system administrator run
490 .BR e2fsck (8)
491 if necessary.  After setting the 
492 .B dir_index
493 feature, 
494 .B e2fsck -D
495 can be run to convert existing directories to the hashed B-tree format.
496 Enabling certain filesystem features may prevent the filesystem from being
497 mounted by kernels which do not support those features.  In particular, the
498 .BR uninit_bg
499 and
500 .BR flex_bg
501 features are only supported by the ext4 filesystem.
502 .TP
503 .BI \-r " reserved-blocks-count"
504 Set the number of reserved filesystem blocks.
505 .TP
506 .BI \-T " time-last-checked"
507 Set the time the filesystem was last checked using
508 .BR  e2fsck .
509 The time is interpreted using the current (local) timezone.
510 This can be useful in scripts which use a Logical Volume Manager to make
511 a consistent snapshot of a filesystem, and then check the filesystem 
512 during off hours to make sure it hasn't been corrupted due to 
513 hardware problems, etc.  If the filesystem was clean, then this option can 
514 be used to set the last checked time on the original filesystem.  The format 
515 of 
516 .I time-last-checked
517 is the international date format, with an optional time specifier, i.e.
518 YYYYMMDD[HH[MM[SS]]].   The keyword 
519 .B now
520 is also accepted, in which case the last checked time will be set to the 
521 current time.
522 .TP
523 .BI \-u " user"
524 Set the user who can use the reserved filesystem blocks.
525 .I user
526 can be a numerical uid or a user name.  If a user name is given, it 
527 is converted to a numerical uid before it is stored in the superblock.
528 .TP
529 .BI \-U " UUID"
530 Set the universally unique identifier (UUID) of the filesystem to
531 .IR UUID .
532 The format of the UUID is a series of hex digits separated by hyphens, 
533 like this: 
534 "c1b9d5a2-f162-11cf-9ece-0020afc76f16".  
535 The 
536 .I UUID
537 parameter may also be one of the following:
538 .RS 1.2i
539 .TP
540 .I clear
541 clear the filesystem UUID
542 .TP
543 .I random
544 generate a new randomly-generated UUID
545 .TP
546 .I time
547 generate a new time-based UUID
548 .RE
549 .IP
550 The UUID may be used by
551 .BR mount (8),
552 .BR fsck (8),
553 and
554 .BR /etc/fstab (5)
555 (and possibly others) by specifying
556 .BI UUID= uuid
557 instead of a block special device name like
558 .BR /dev/hda1 .
559 .IP
560 See
561 .BR uuidgen (8)
562 for more information.
563 If the system does not have a good random number generator such as
564 .I /dev/random
565 or
566 .IR /dev/urandom ,
567 .B tune2fs
568 will automatically use a time-based UUID instead of a randomly-generated UUID.
569 .SH BUGS
570 We haven't found any bugs yet.  That doesn't mean there aren't any...
571 .SH AUTHOR
572 .B tune2fs 
573 was written by Remy Card <Remy.Card@linux.org>.  It is currently being
574 maintained by Theodore Ts'o <tytso@alum.mit.edu>.
575 .B tune2fs
576 uses the ext2fs library written by Theodore Ts'o <tytso@mit.edu>.
577 This manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>.
578 Time-dependent checking was added by Uwe Ohse <uwe@tirka.gun.de>.
579 .SH AVAILABILITY
580 .B tune2fs
581 is part of the e2fsprogs package and is available from 
582 http://e2fsprogs.sourceforge.net.
583 .SH SEE ALSO
584 .BR debugfs (8),
585 .BR dumpe2fs (8),
586 .BR e2fsck (8),
587 .BR mke2fs (8)