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