title: e2fsck(8)

text:
# e2fsck(8)

## NAME
e2fsck - check a Linux ext2/ext3/ext4 file system

## SYNOPSIS
e2fsck [ -pacnyrdfkvtDFV ] [ -b superblock ] [ -B blocksize ] [ -l|-L bad_blocks_file ] [ -C fd ] [ -j external-journal ] [ -E extended_options ] [ -z undo_file ] device

## DESCRIPTION
e2fsck is used to check the ext2/ext3/ext4 family of file systems. For ext3 and ext4 file systems that use a journal, if the system has been shut down uncleanly without any errors, normally, after replaying the committed transactions in the journal, the file system should be marked as clean. Hence, for file systems that use journaling, e2fsck will normally replay the journal and exit, unless its superblock indicates that further checking is required.

device is a block device (e.g., /dev/sdc1) or file containing the file system.

Note that in general it is not safe to run e2fsck on mounted file systems. The only exception is if the -n option is specified, and -c, -l, or -L options are not specified. However, even if it is safe to do so, the results printed by e2fsck are not valid if the file system is mounted. If e2fsck asks whether or not you should check a file system which is mounted, the only correct answer is ``no''. Only experts who really know what they are doing should consider answering this question in any other way.

If e2fsck is run in interactive mode (meaning that none of -y, -n, or -p are specified), the program will ask the user to fix each problem found in the file system. A response of 'y' will fix the error; 'n' will leave the error unfixed; and 'a' will fix the problem and all subsequent problems; pressing Enter will proceed with the default response, which is printed before the question mark. Pressing Control-C terminates e2fsck immediately.

## OPTIONS
-a

This option does the same thing as the -p option. It is provided for backwards compatibility only; it is suggested that people use -p option whenever possible.

-b superblock

Instead of using the normal superblock, use an alternative superblock specified by superblock. This option is normally used when the primary superblock has been corrupted. The location of backup superblocks is dependent on the file system's blocksize, the number of blocks per group, and features such as sparse_super.

Additional backup superblocks can be determined by using the mke2fs program using the -n option to print out where the superblocks exist, supposing mke2fs is supplied with arguments that are consistent with the file system's layout (e.g. blocksize, blocks per group, sparse_super, etc.).

If an alternative superblock is specified and the file system is not opened read-only, e2fsck will make sure that the primary superblock is updated appropriately upon completion of the file system check.

-B blocksize

Normally, e2fsck will search for the superblock at various different block sizes in an attempt to find the appropriate block size. This search can be fooled in some cases. This option forces e2fsck to only try locating the superblock at a particular blocksize. If the superblock is not found, e2fsck will terminate with a fatal error.

-c

This option causes e2fsck to use badblocks(8) program to do a read-only scan of the device in order to find any bad blocks. If any bad blocks are found, they are added to the bad block inode to prevent them from being allocated to a file or directory. If this option is specified twice, then the bad block scan will be done using a non-destructive read-write test.

-C fd

This option causes e2fsck to write completion information to the specified file descriptor so that the progress of the file system check can be monitored. This option is typically used by programs which are running e2fsck. If the file descriptor number is negative, then absolute value of the file descriptor will be used, and the progress information will be suppressed initially. It can later be enabled by sending the e2fsck process a SIGUSR1 signal. If the file descriptor specified is 0, e2fsck will print a completion bar as it goes about its business. This requires that e2fsck is running on a video console or terminal.

-d

Print debugging output (useless unless you are debugging e2fsck).

-D

Optimize directories in file system. This option causes e2fsck to try to optimize all directories, either by re-indexing them if the file system supports directory indexing, or by sorting and compressing directories for smaller directories, or for file systems using traditional linear directories.

Even without the -D option, e2fsck may sometimes optimize a few directories --- for example, if directory indexing is enabled and a directory is not indexed and would benefit from being indexed, or if the index structures are corrupted and need to be rebuilt. The -D option forces all directories in the file system to be optimized. This can sometimes make them a little smaller and slightly faster to search, but in practice, you should rarely need to use this option.

The -D option will detect directory entries with duplicate names in a single directory, which e2fsck normally does not enforce for performance reasons.

-E extended_options

Set e2fsck extended options. Extended options are comma separated, and may take an argument using the equals ('=') sign. The following options are supported:

ea_ver=extended_attribute_version

Set the version of the extended attribute blocks which e2fsck will require while checking the file system. The version number may be 1 or 2. The default extended attribute version format is 2.

journal_only

Only replay the journal if required, but do not perform any further checks or repairs.

fragcheck

During pass 1, print a detailed report of any discontiguous blocks for files in the file system.

discard

Attempt to discard free blocks and unused inode blocks after the full file system check (discarding blocks is useful on solid state devices and sparse / thin-provisioned storage). Note that discard is done in pass 5 AFTER the file system has been fully checked and only if it does not contain recognizable errors. However there might be cases where e2fsck does not fully recognize a problem and hence in this case this option may prevent you from further manual data recovery.

nodiscard

Do not attempt to discard free blocks and unused inode blocks. This option is exactly the opposite of discard option. This is set as default.

no_optimize_extents

Do not offer to optimize the extent tree by eliminating unnecessary width or depth. This can also be enabled in the options section of /etc/e2fsck.conf.

optimize_extents

Offer to optimize the extent tree by eliminating unnecessary width or depth. This is the default unless otherwise specified in /etc/e2fsck.conf.

inode_count_fullmap

Trade off using memory for speed when checking a file system with a large number of hard-linked files. The amount of memory required is proportional to the number of inodes in the file system. For large file systems, this can be gigabytes of memory. (For example, a 40 TB file system with 2.8 billion inodes will consume an additional 5.7 GB memory if this optimization is enabled.) This optimization can also be enabled in the options section of /etc/e2fsck.conf.

no_inode_count_fullmap

Disable the inode_count_fullmap optimization. This is the default unless otherwise specified in /etc/e2fsck.conf.

readahead_kb

Use this many KiB of memory to pre-fetch metadata in the hopes of reducing e2fsck runtime. By default, this is set to the size of two block groups' inode tables (typically 4 MiB on a regular ext4 file system); if this amount is more than 1/50th of total physical memory, readahead is disabled. Set this to zero to disable readahead entirely.

bmap2extent

Convert block-mapped files to extent-mapped files.

fixes_only

Only fix damaged metadata; do not optimize htree directories or compress extent trees. This option is incompatible with the -D and -E bmap2extent options.

check_encoding

Force verification of encoded filenames in case-insensitive directories. This is the default mode if the file system has the strict flag enabled.

unshare_blocks

If the file system has shared blocks, with the shared blocks read-only feature enabled, then this will unshare all shared blocks and unset the read-only feature bit. If there is not enough free space then the operation will fail. If the file system does not have the read-only feature bit, but has shared blocks anyway, then this option will have no effect. Note when using this option, if there is no free space to clone blocks, there is no prompt to delete files and instead the operation will fail.

Note that unshare_blocks implies the "-f" option to ensure that all passes are run. Additionally, if "-n" is also specified, e2fsck will simulate trying to allocate enough space to deduplicate. If this fails, the exit code will be non-zero.

-f

Force checking even if the file system seems clean.

-F

Flush the file system device's buffer caches before beginning. Only really useful for doing e2fsck time trials.

-j external-journal

Set the pathname where the external-journal for this file system can be found.

-k

When combined with the -c option, any existing bad blocks in the bad blocks list are preserved, and any new bad blocks found by running badblocks(8) will be added to the existing bad blocks list.

-l filename

Add the block numbers listed in the file specified by filename to the list of bad blocks. The format of this file is the same as the one generated by the badblocks(8) program. Note that the block numbers are based on the blocksize of the file system. Hence, badblocks(8) must be given the blocksize of the file system in order to obtain correct results. As a result, it is much simpler and safer to use the -c option to e2fsck, since it will assure that the correct parameters are passed to the badblocks program.

-L filename

Set the bad blocks list to be the list of blocks specified by filename. (This option is the same as the -l option, except the bad blocks list is cleared before the blocks listed in the file are added to the bad blocks list.)

-n

Open the file system read-only, and assume an answer of `no' to all questions. Allows e2fsck to be used non-interactively. This option may not be specified at the same time as the -p or -y options.

-p

Automatically repair ("preen") the file system. This option will cause e2fsck to automatically fix any file system problems that can be safely fixed without human intervention. If e2fsck discovers a problem which may require the system administrator to take additional corrective action, e2fsck will print a description of the problem and then exit with the value 4 logically or'ed into the exit code. (See the EXIT CODE section.) This option is normally used by the system's boot scripts. It may not be specified at the same time as the -n or -y options.

-r

This option does nothing at all; it is provided only for backwards compatibility.

-t

Print timing statistics for e2fsck. If this option is used twice, additional timing statistics are printed on a pass by pass basis.

-v

Verbose mode.

-V

Print version information and exit.

-y

Assume an answer of `yes' to all questions; allows e2fsck to be used non-interactively. This option may not be specified at the same time as the -n or -p options.

-z undo_file

Before overwriting a file system block, write the old contents of the block to an undo file. This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong. If the empty string is passed as the undo_file argument, the undo file will be written to a file named e2fsck-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable. WARNING: The undo file cannot be used to recover from a power or system crash.

## EXIT CODE
The exit code returned by e2fsck is the sum of the following conditions:

0 - No errors

1 - File system errors corrected

2 - File system errors corrected, system should

be rebooted

4 - File system errors left uncorrected

8 - Operational error

16 - Usage or syntax error

32 - E2fsck canceled by user request

128 - Shared library error

## SIGNALS
The following signals have the following effect when sent to e2fsck.

SIGUSR1

This signal causes e2fsck to start displaying a completion bar or emitting progress information. (See discussion of the -C option.)

SIGUSR2

This signal causes e2fsck to stop displaying a completion bar or emitting progress information.

## REPORTING BUGS
Almost any piece of software will have bugs. If you manage to find a file system which causes e2fsck to crash, or which e2fsck is unable to repair, please report it to the author.

Please include as much information as possible in your bug report. Ideally, include a complete transcript of the e2fsck run, so I can see exactly what error messages are displayed. (Make sure the messages printed by e2fsck are in English; if your system has been configured so that e2fsck's messages have been translated into another language, please set the LC_ALL environment variable to C so that the transcript of e2fsck's output will be useful to me.) If you have a writable file system where the transcript can be stored, the script(1) program is a handy way to save the output of e2fsck to a file.

It is also useful to send the output of dumpe2fs(8). If a specific inode or inodes seems to be giving e2fsck trouble, try running the debugfs(8) command and send the output of the stat(1u) command run on the relevant inode(s). If the inode is a directory, the debugfs dump command will allow you to extract the contents of the directory inode, which can sent to me after being first run through uuencode(1). The most useful data you can send to help reproduce the bug is a compressed raw image dump of the file system, generated using e2image(8). See the e2image(8) man page for more details.

Always include the full version string which e2fsck displays when it is run, so I know which version you are running.

## ENVIRONMENT
E2FSCK_CONFIG

Determines the location of the configuration file (see e2fsck.conf(5)).

## AUTHOR
This version of e2fsck was written by Theodore Ts'o <tytso@mit.edu>.

## SEE ALSO
e2fsck.conf(5), badblocks(8), dumpe2fs(8), debugfs(8), e2image(8), mke2fs(8), tune2fs(8)


title: e2image(8)

text:
# e2image(8)

## NAME
e2image - Save critical ext2/ext3/ext4 file system metadata to a file

## SYNOPSIS
e2image [-r|-Q [-af]] [ -b superblock ] [ -B blocksize ] [ -cnps ] [ -o src_offset ] [ -O dest_offset ] device image-file

e2image -I device image-file

## DESCRIPTION
The e2image program will save critical ext2, ext3, or ext4 file system metadata located on device to a file specified by image-file. The image file may be examined by dumpe2fs and debugfs, by using the -i option to those programs. This can assist an expert in recovering catastrophically corrupted file systems.

It is a very good idea to create image files for all file systems on a system and save the partition layout (which can be generated using the fdisk -l command) at regular intervals — at boot time, and/or every week or so. The image file should be stored on some file system other than the file system whose data it contains, to ensure that this data is accessible in the case where the file system has been badly damaged.

To save disk space, e2image creates the image file as a sparse file, or in QCOW2 format. Hence, if the sparse image file needs to be copied to another location, it should either be compressed first or copied using the --sparse=always option to the GNU version of cp(1). This does not apply to the QCOW2 image, which is not sparse.

The size of an ext2 image file depends primarily on the size of the file systems and how many inodes are in use. For a typical 10 Gigabyte file system, with 200,000 inodes in use out of 1.2 million inodes, the image file will be approximately 35 Megabytes; a 4 Gigabyte file system with 15,000 inodes in use out of 550,000 inodes will result in a 3 Megabyte image file. Image files tend to be quite compressible; an image file taking up 32 Megabytes of space on disk will generally compress down to 3 or 4 Megabytes.

If image-file is -, then the output of e2image will be sent to standard output, so that the output can be piped to another program, such as gzip(1). (Note that this is currently only supported when creating a raw image file using the -r option, since the process of creating a normal image file, or QCOW2 image currently requires random access to the file, which cannot be done using a pipe.

## OPTIONS
-a

Include file data in the image file. Normally e2image only includes fs metadata, not regular file data. This option will produce an image that is suitable to use to clone the entire FS or for backup purposes. Note that this option only works with the raw (-r) or QCOW2 (-Q) formats. In conjunction with the -r option it is possible to clone all and only the used blocks of one file system to another device/image file.

-b superblock

Get image from partition with broken primary superblock by using the superblock located at file system block number superblock. The partition is copied as-is including broken primary superblock.

-B blocksize

Set the file system blocksize in bytes. Normally, e2image will search for the superblock at various different block sizes in an attempt to find the appropriate blocksize. This search can be fooled in some cases. This option forces e2fsck to only try locating the superblock with a particular blocksize. If the superblock is not found, e2image will terminate with a fatal error.

-c

Compare each block to be copied from the source device to the corresponding block in the target image-file. If both are already the same, the write will be skipped. This is useful if the file system is being cloned to a flash-based storage device (where reads are very fast and where it is desirable to avoid unnecessary writes to reduce write wear on the device).

-f

Override the read-only requirement for the source file system when saving the image file using the -r and -Q options. Normally, if the source file system is in use, the resulting image file is very likely not going to be useful. In some cases where the source file system is in constant use this may be better than no image at all.

-I

install the metadata stored in the image file back to the device. It can be used to restore the file system metadata back to the device in emergency situations.

WARNING!!!! The -I option should only be used as a desperation measure when other alternatives have failed. If the file system has changed since the image file was created, data will be lost. In general, you should make another full image backup of the file system first, in case you wish to try other recovery strategies afterward.

-n

Cause all image writes to be skipped, and instead only print the block numbers that would have been written.

-o src_offset

Specify offset of the image to be read from the start of the source device in bytes. See OFFSETS for more details.

-O tgt_offset

Specify offset of the image to be written from the start of the target image-file in bytes. See OFFSETS for more details.

-p

Show progress of image-file creation.

-Q

Create a QCOW2-format image file instead of a normal image file, suitable for use by virtual machine images, and other tools that can use the .qcow image format. See QCOW2 IMAGE FILES below for details.

-r

Create a raw image file instead of a normal image file. See RAW IMAGE FILES below for details.

-s

Scramble directory entries and zero out unused portions of the directory blocks in the written image file to avoid revealing information about the contents of the file system. However, this will prevent analysis of problems related to hash-tree indexed directories.

## RAW IMAGE FILES
The -r option will create a raw image file, which differs from a normal image file in two ways. First, the file system metadata is placed in the same relative offset within image-file as it is in the device so that debugfs(8), dumpe2fs(8), e2fsck(8), losetup(8), etc. can be run directly on the raw image file. In order to minimize the amount of disk space consumed by the raw image file, it is created as a sparse file. (Beware of copying or compressing/decompressing this file with utilities that don't understand how to create sparse files; the file will become as large as the file system itself!) Secondly, the raw image file also includes indirect blocks and directory blocks, which the standard image file does not have.

Raw image files are sometimes used when sending file systems to the maintainer as part of bug reports to e2fsprogs. When used in this capacity, the recommended command is as follows (replace hda1 with the appropriate device for your system):

e2image -r /dev/hda1 - | bzip2 > hda1.e2i.bz2

This will only send the metadata information, without any data blocks. However, the filenames in the directory blocks can still reveal information about the contents of the file system that the bug reporter may wish to keep confidential. To address this concern, the -s option can be specified to scramble the filenames in the image.

Note that this will work even if you substitute /dev/hda1 for another raw disk image, or QCOW2 image previously created by e2image.

## QCOW2 IMAGE FILES
The -Q option will create a QCOW2 image file instead of a normal, or raw image file. A QCOW2 image contains all the information the raw image does, however unlike the raw image it is not sparse. The QCOW2 image minimize the amount of space used by the image by storing it in special format which packs data closely together, hence avoiding holes while still minimizing size.

In order to send file system to the maintainer as a part of bug report to e2fsprogs, use following commands (replace hda1 with the appropriate device for your system):

e2image -Q /dev/hda1 hda1.qcow2

bzip2 -z hda1.qcow2

This will only send the metadata information, without any data blocks. As described for RAW IMAGE FILES the -s option can be specified to scramble the file system names in the image.

Note that the QCOW2 image created by e2image is a regular QCOW2 image and can be processed by tools aware of QCOW2 format such as for example qemu-img.

You can convert a .qcow2 image into a raw image with:

e2image -r hda1.qcow2 hda1.raw

This can be useful to write a QCOW2 image containing all data to a sparse image file where it can be loop mounted, or to a disk partition. Note that this may not work with QCOW2 images not generated by e2image.

## OFFSETS
Normally a file system starts at the beginning of a partition, and e2image is run on the partition. When working with image files, you don't have the option of using the partition device, so you can specify the offset where the file system starts directly with the -o option. Similarly the -O option specifies the offset that should be seeked to in the destination before writing the file system.

For example, if you have a dd image of a whole hard drive that contains an ext2 fs in a partition starting at 1 MiB, you can clone that image to a block device with:

e2image -aro 1048576 img /dev/sda1

Or you can clone a file system from a block device into an image file, leaving room in the first MiB for a partition table with:

e2image -arO 1048576 /dev/sda1 img

If you specify at least one offset, and only one file, an in-place move will be performed, allowing you to safely move the file system from one offset to another.

## AUTHOR
e2image was written by Theodore Ts'o (tytso@mit.edu).

## AVAILABILITY
e2image is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

## SEE ALSO
dumpe2fs(8), debugfs(8), e2fsck(8)

branch: sisyphus


title: e2label(8)

text:
# e2label(8)

## NAME
e2label - Change the label on an ext2/ext3/ext4 file system

## SYNOPSIS
e2label device [ volume-label ]

## DESCRIPTION
e2label will display or change the volume label on the ext2, ext3, or ext4 file system located on device.

If the optional argument volume-label is not present, e2label will simply display the current volume label.

If the optional argument volume-label is present, then e2label will set the volume label to be volume-label. Ext2 volume labels can be at most 16 characters long; if volume-label is longer than 16 characters, e2label will truncate it and print a warning message. For other file systems that support online label manipulation and are mounted e2label will work as well, but it will not attempt to truncate the volume-label at all.

It is also possible to set the volume label using the -L option of tune2fs(8).

## AUTHOR
e2label was written by Theodore Ts'o (tytso@mit.edu).

## AVAILABILITY
e2label is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

## SEE ALSO
mke2fs(8), tune2fs(8)


title: e2mmpstatus(8)

summary: Check MMP status of an ext4 file system

text:
# e2mmpstatus(8)

## NAME
e2mmpstatus - Check MMP status of an ext4 file system

## SYNOPSIS
e2mmpstatus [-i] <filesystem>

## OPTIONS
-i

prints out the MMP information rather than check it.

## DESCRIPTION
e2mmpstatus is used to check Multiple-Mount Protection (MMP) status of an ext4 file system with the mmp feature enabled. The specified file system can be a device name (e.g. /dev/hdc1, /dev/sdb2), or an ext4 file system label or UUID, for example UUID=8868abf6-88c5-4a83-98b8-bfc24057f7bd or LABEL=root. By default, the e2mmpstatus program checks whether it is safe to mount the file system without taking the risk of mounting it more than once.

MMP (multiple-mount protection) is a feature that adds protection against the file system being modified simultaneously by more than one node. It is NOT safe to mount a file system when one of the following conditions is true:

1. e2fsck is running on the file system.

2. the file system is in use by another node.

3. The MMP block is corrupted or cannot be read for some reason.

The e2mmpstatus program might wait for some time to see whether the MMP block is being updated by any node during this period. The time taken depends on how frequently the MMP block is being written by the other node.

## EXIT CODE
The exit code returned by e2mmpstatus is 0 when it is safe to mount the file system, 1 when the MMP block shows the file system is in use on another node and it is NOT safe to mount the file system, and 2 if some other failure occurred that prevents the check from properly detecting the current MMP status.

## SEE ALSO
dumpe2fs(8), e2fsck(8), fstab(5), fsck(8),


title: e2scrub(8)

text:
# e2scrub(8)

## NAME
e2scrub - check the contents of a mounted ext[234] file system

## SYNOPSIS
e2scrub [OPTION] MOUNTPOINT | DEVICE

## DESCRIPTION
e2scrub attempts to check (but not repair) all metadata in a mounted ext[234] file system if the file system resides on an LVM logical volume. The block device of the LVM logical volume can also be passed in.

This program snapshots the volume and runs a file system check on the snapshot to look for corruption errors. The LVM volume group must have at least 256MiB of unallocated space to dedicate to the snapshot or the logical volume will be skipped. The snapshot will be named lvname.e2scrub and udev will not create symbolic links to it under /dev/disk. Every attempt will be made to remove the snapshots prior to running e2scrub, but in a dire situation it may be necessary to remove the snapshot manually.

If no errors are found, fstrim can be called on the file system if it is mounted. If errors are found, the file system will be marked as having errors. The file system should be taken offline and e2fsck run as soon as possible, because e2scrub does not fix corruptions. If the file system is not repaired, e2fsck will be run before the next mount.

## OPTIONS
-n

Print what commands e2scrub would execute to check the file system. (Note: the commands will not actually be executed; however, since e2scrub needs to run some commands to query the system to determine what commands would be executed, it still needs to be run as root.)

-r

Remove the e2scrub snapshot and exit without checking anything.

-t

Run fstrim(1) on the mounted file system if no errors are found.

-V

Print version information and exit.

## EXIT CODE
The exit codes are the same as in e2fsck(8)

## SEE ALSO
e2fsck(8)

## AUTHOR
Darrick J. Wong <darrick.wong@oracle.com>

## COPYRIGHT
Copyright ©2018 Oracle. License is GPLv2+. <http://www.gnu.org/licenses/gpl-2.0.html>


title: e2scrub_all(8)

text:
# e2scrub_all(8)

## NAME
e2scrub_all - check all mounted ext[234] file systems for errors.

## SYNOPSIS
e2scrub_all [OPTION]

## DESCRIPTION
Searches the system for all LVM logical volumes containing an ext2, ext3, or ext4 file system, and checks them for problems. The checking is performed by invoking the e2scrub tool, which will look for corruptions. Corrupt file systems will be tagged as having errors so that fsck will be invoked before the next mount. If no errors are encountered, fstrim will be called on the file system if it is mounted. See the e2scrub manual page for more information about how the checking is performed.

## OPTIONS
-n

Print what commands e2scrub_all would execute to initiate the e2scrub operations. (Note: these commands will not actually be executed; however, since e2scrub_all needs to run some additional, privileged commands to query the system to determine which e2scrub commands would be executed, it still needs to be run as root.)

-r

Remove e2scrub snapshots but do not check anything.

-A

Scrub all ext[234] file systems even if they are not mounted.

-V

Print version information and exit.

## SEE ALSO
e2scrub(8)

## AUTHOR
Darrick J. Wong <darrick.wong@oracle.com>

## COPYRIGHT
Copyright ©2018 Oracle. License is GPLv2+. <http://www.gnu.org/licenses/gpl-2.0.html>


title: e2undo(8)

text:
# e2undo(8)

## NAME
e2undo - Replay an undo log for an ext2/ext3/ext4 file system

## SYNOPSIS
e2undo [ -f ] [ -h ] [ -n ] [ -o offset ] [ -v ] [ -z undo_file ] undo_log device

## DESCRIPTION
e2undo will replay the undo log undo_log for an ext2/ext3/ext4 file system found on device. This can be used to undo a failed operation by an e2fsprogs program.

## OPTIONS
-f

Normally, e2undo will check the file system superblock to make sure the undo log matches with the file system on the device. If they do not match, e2undo will refuse to apply the undo log as a safety mechanism. The -f option disables this safety mechanism.

-h

Display a usage message.

-n

Dry-run; do not actually write blocks back to the file system.

-o offset

Specify the file system's offset (in bytes) from the beginning of the device or file.

-v

Report which block we're currently replaying.

-z undo_file

Before overwriting a file system block, write the old contents of the block to an undo file. This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong. If the empty string is passed as the undo_file argument, the undo file will be written to a file named e2undo-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable. WARNING: The undo file cannot be used to recover from a power or system crash.

## AUTHOR
e2undo was written by Aneesh Kumar K.V. (aneesh.kumar@linux.vnet.ibm.com)

## AVAILABILITY
e2undo is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

## SEE ALSO
mke2fs(8), tune2fs(8)


title: e4crypt(8)

summary: ext4 file system encryption utility

text:
# e4crypt(8)

## NAME
e4crypt - ext4 file system encryption utility

## SYNOPSIS
e4crypt add_key -S [ -k keyring ] [-v] [-q] [ -p pad ] [ path ... ]

e4crypt new_session

e4crypt get_policy path ...

e4crypt set_policy [ -p pad ] policy path ...

## DESCRIPTION
e4crypt performs encryption management for ext4 file systems.

## COMMANDS
e4crypt add_key [-vq] [-S salt ] [-k keyring ] [ -p pad ] [ path ... ]

Prompts the user for a passphrase and inserts it into the specified keyring. If no keyring is specified, e4crypt will use the session keyring if it exists or the user session keyring if it does not.

A salt is used to convert the passphrase into an encryption key, and ensures that if the user uses the same passphrase in different contexts, different salt values will result in different encryption keys. By default, e4crypt will examine all mounted ext4 file systems, and insert an encryption key salted with each file system with encryption enabled with its default salt value.

Alternatively, if the user specifies an explicit salt, that salt value will be used to calculate the encryption key from the passphrase. If the first two characters of salt are "s:", then the rest of the argument will be used as a text string and used as the salt value. If the first two characters are "0x", then the rest of the argument will be parsed as a hex string and the hex value will be used as the salt. If the first characters are "f:" then the rest of the argument will be interpreted as a filename from which the salt value will be read. If the string begins with a '/' character, it will similarly be treated as filename. Finally, if the salt argument can be parsed as a valid UUID, then the UUID value will be used as a salt value.

The keyring argument specifies the keyring to which the key should be added.

The pad value specifies the number of bytes of padding will be added to directory names for obfuscation purposes. Valid pad values are 4, 8, 16, and 32.

If one or more directory paths are specified, e4crypt will try to set the policy of those directories to use the key just added by the add_key command. If a salt was explicitly specified, then it will be used to derive the encryption key of those directories. Otherwise a directory-specific default salt will be used.

e4crypt get_policy path ...

Print the policy for the directories specified on the command line.

e4crypt new_session

Give the invoking process (typically a shell) a new session keyring, discarding its old session keyring.

e4crypt set_policy [ -p pad ] policy path ...

Sets the policy for the directories specified on the command line. All directories must be empty to set the policy; if the directory already has a policy established, e4crypt will validate that the policy matches what was specified. A policy is an encryption key identifier consisting of 16 hexadecimal characters.

## AUTHOR
Written by Michael Halcrow <mhalcrow@google.com>, Ildar Muslukhov <muslukhovi@gmail.com>, and Theodore Ts'o <tytso@mit.edu>

## SEE ALSO
keyctl(1), mke2fs(8), mount(8).


title: e4defrag(8)

text:
# e4defrag(8)

## NAME
e4defrag - online defragmenter for ext4 file system

## SYNOPSIS
e4defrag [ -c ] [ -v ] target ...

## DESCRIPTION
e4defrag reduces fragmentation of extent based file. The file targeted by e4defrag is created on ext4 file system made with "-O extent" option (see mke2fs(8)). The targeted file gets more contiguous blocks and improves the file access speed.

target is a regular file, a directory, or a device that is mounted as ext4 file system. If target is a directory, e4defrag reduces fragmentation of all files in it. If target is a device, e4defrag gets the mount point of it and reduces fragmentation of all files in this mount point.

## OPTIONS
-c

Get a current fragmentation count and an ideal fragmentation count, and calculate fragmentation score based on them. By seeing this score, we can determine whether we should execute e4defrag to target. When used with -v option, the current fragmentation count and the ideal fragmentation count are printed for each file.

Also this option outputs the average data size in one extent. If you see it, you'll find the file has ideal extents or not. Note that the maximum extent size is 131072KB in ext4 file system (if block size is 4KB).

If this option is specified, target is never defragmented.

-v

Print error messages and the fragmentation count before and after defrag for each file.

## NOTES
e4defrag does not support swap file, files in lost+found directory, and files allocated in indirect blocks. When target is a device or a mount point, e4defrag doesn't defragment files in mount point of other device.

It is safe to run e4defrag on a file while it is actively in use by another application. Since the contents of file blocks are copied using the page cache, this can result in a performance slowdown to both e4defrag and the application due to contention over the system's memory and disk bandwidth.

If the file system's free space is fragmented, or if there is insufficient free space available, e4defrag may not be able to improve the file's fragmentation.

Non-privileged users can execute e4defrag to their own file, but the score is not printed if -c option is specified. Therefore, it is desirable to be executed by root user.

## AUTHOR
Written by Akira Fujita <a-fujita@rs.jp.nec.com> and Takashi Sato <t-sato@yk.jp.nec.com>.

## SEE ALSO
mke2fs(8), mount(8).


filefrag

title: filefrag(8)

summary: report on file fragmentation

text:
# filefrag(8)

## NAME
filefrag - report on file fragmentation

## SYNOPSIS
filefrag [ -bblocksize ] [ -BeEkPsvVxX ] [ files... ]

## DESCRIPTION
filefrag reports on how badly fragmented a particular file might be. It makes allowances for indirect blocks for ext2 and ext3 file systems, but can be used on files for any file system.

The filefrag program initially attempts to get the extent information using FIEMAP ioctl which is more efficient and faster. If FIEMAP is not supported then filefrag will fall back to using FIBMAP.

## OPTIONS
-B

Force the use of the older FIBMAP ioctl instead of the FIEMAP ioctl for testing purposes.

-bblocksize

Use blocksize in bytes, or with [KMG] suffix, up to 1GB for output instead of the file system blocksize. For compatibility with earlier versions of filefrag, if blocksize is unspecified it defaults to 1024 bytes. Since blocksize is an optional argument, it must be added without any space after -b.

-e

Print output in extent format, even for block-mapped files.

-E

Display the contents of ext4's extent status cache. This feature is not supported on all kernels, and is only supported on ext4 file systems.

-k

Use 1024-byte blocksize for output (identical to '-b1024').

-P

Pre-load the ext4 extent status cache for the file. This is not supported on all kernels, and is only supported on ext4 file systems.

-s

Sync the file before requesting the mapping.

-v

Be verbose when checking for file fragmentation.

-V

Print version number of program and library. If given twice, also print the FIEMAP flags that are understood by the current version.

-x

Display mapping of extended attributes.

-X

Display extent block numbers in hexadecimal format.

## AUTHOR
filefrag was written by Theodore Ts'o <tytso@mit.edu>.


logsave

title: logsave(8)

text:
# logsave(8)

## NAME
logsave - save the output of a command in a logfile

## SYNOPSIS
logsave [ -asv ] logfile cmd_prog [ ... ]

## DESCRIPTION
The logsave program will execute cmd_prog with the specified argument(s), and save a copy of its output to logfile. If the containing directory for logfile does not exist, logsave will accumulate the output in memory until it can be written out. A copy of the output will also be written to standard output.

If cmd_prog is a single hyphen ('-'), then instead of executing a program, logsave will take its input from standard input and save it in logfile

logsave is useful for saving the output of initial boot scripts until the /var partition is mounted, so the output can be written to /var/log.

## OPTIONS
-a

This option will cause the output to be appended to logfile, instead of replacing its current contents.

-s

This option will cause logsave to skip writing to the log file text which is bracketed with a control-A (ASCII 001 or Start of Header) and control-B (ASCII 002 or Start of Text). This allows progress bar information to be visible to the user on the console, while not being written to the log file.

-v

This option will make logsave to be more verbose in its output to the user.

## AUTHOR
Theodore Ts'o (tytso@mit.edu)

## SEE ALSO
fsck(8)


title: mke2fs(8)

summary: create an ext2/ext3/ext4 file system

text:
# mke2fs(8)

## NAME
mke2fs - create an ext2/ext3/ext4 file system

## SYNOPSIS
mke2fs [ -c | -l filename ] [ -b block-size ] [ -C cluster-size ] [ -d root-directory|tarball|- ] [ -D ] [ -g blocks-per-group ] [ -G number-of-groups ] [ -i bytes-per-inode ] [ -I inode-size ] [ -j ] [ -J journal-options ] [ -N number-of-inodes ] [ -n ] [ -m reserved-blocks-percentage ] [ -o creator-os ] [ -O [^]feature[,...] ] [ -q ] [ -E extended-options ] [ -v ] [ -F ] [ -L volume-label ] [ -M last-mounted-directory ] [ -S ] [ -t fs-type ] [ -T usage-type ] [ -U UUID ] [ -V ] [ -e errors-behavior ] [ -z undo_file ] device [ fs-size ]

mke2fs -O journal_dev [ -b block-size ] [ -L volume-label ] [ -n ] [ -q ] [ -v ] external-journal [ fs-size ]

## DESCRIPTION
mke2fs is used to create an ext2, ext3, or ext4 file system, usually in a disk partition (or file) named by device.

The file system size is specified by fs-size. If fs-size does not have a suffix, it is interpreted as power-of-two kilobytes, unless the -b block-size option is specified, in which case fs-size is interpreted as the number of block-size blocks. If the fs-size is suffixed by 'k', 'm', 'g', 't' (either upper-case or lower-case), then it is interpreted in power-of-two kilobytes, megabytes, gigabytes, terabytes, etc. If fs-size is omitted, mke2fs will create the file system based on the device size.

If mke2fs is run as mkfs.XXX (i.e., mkfs.ext2, mkfs.ext3, or mkfs.ext4) the option -t XXX is implied; so mkfs.ext3 will create a file system for use with ext3, mkfs.ext4 will create a file system for use with ext4, and so on.

The defaults of the parameters for the newly created file system, if not overridden by the options listed below, are controlled by the /etc/mke2fs.conf configuration file. See the mke2fs.conf(5) manual page for more details.

## OPTIONS
-b block-size

Specify the size of blocks in bytes. Valid block-size values are powers of two from 1024 up to 65536 (however note that the kernel is able to mount only file systems with block-size smaller or equal to the system page size - 4k on x86 systems, up to 64k on ppc64 or aarch64 depending on kernel configuration). If omitted, block-size is heuristically determined by the file system size and the expected usage of the file system (see the -T option). In most common cases, the default block size is 4k. If block-size is preceded by a negative sign ('-'), then mke2fs will use heuristics to determine the appropriate block size, with the constraint that the block size will be at least block-size bytes. This is useful for certain hardware devices which require that the blocksize be a multiple of 2k.

-c

Check the device for bad blocks before creating the file system. If this option is specified twice, then a slower read-write test is used instead of a fast read-only test.

-C cluster-size

Specify the size of clusters in bytes for file systems using the bigalloc feature. Valid cluster-size values range from 2 to 32768 times the filesystem block size and must be a power of 2. The cluster-size can only be specified if the bigalloc feature is enabled. (See the ext4(5) man page for more details about bigalloc.) The default cluster size if bigalloc is enabled is 16 times the block size.

-d root-directory|tarball|-

Copy the contents of the given directory or tarball into the root directory of the file system. Tarball input is only available if mke2fs was compiled with libarchive support enabled and if the libarchive shared library is available at run-time. The special value "-" will read a tarball from standard input.

-D

Use direct I/O when writing to the disk. This avoids mke2fs dirtying a lot of buffer cache memory, which may impact other applications running on a busy server. This option will cause mke2fs to run much more slowly, however, so there is a tradeoff to using direct I/O.

-e error-behavior

Change the behavior of the kernel code when errors are detected. In all cases, a file system error will cause e2fsck(8) to check the file system on the next boot. error-behavior can be one of the following:

continue

Continue normal execution.

remount-ro

Remount file system read-only.

panic

Cause a kernel panic.

-E extended-options

Set extended options for the file system. Extended options are comma separated, and may take an argument using the equals ('=') sign. Multiple -E options may also be used. The -E option used to be -R in earlier versions of mke2fs. The -R option is still accepted for backwards compatibility, but is deprecated. The following extended options are supported:

assume_storage_prezeroed[=<0 to disable | 1 to enable>]

If enabled, mke2fs assumes that the storage device has been prezeroed, skips zeroing the journal and inode tables, and annotates the block group flags to signal that the inode table has been zeroed.

discard

Attempt to discard blocks at mkfs time (discarding blocks initially is useful on solid state devices and sparse / thin-provisioned storage). When the device advertises that discard also zeroes data (any subsequent read after the discard and before write returns zero), then mark all not-yet-zeroed inode tables as zeroed. This significantly speeds up file system initialization. This is set as default.

encoding=encoding-name

Enable the casefold feature in the super block and set encoding-name as the encoding to be used. If encoding-name is not specified, the encoding defined in mke2fs.conf(5) is used.

encoding_flags=encoding-flags

Define parameters for file name character encoding operations. If a flag is not changed using this parameter, its default value is used. encoding-flags should be a comma-separated lists of flags to be enabled. To disable a flag, add it to the list with the prefix "no". The only flag that can be set right now is strict which means that invalid strings should be rejected by the file system. In the default configuration, the strict flag is disabled.

hash_seed=UUID

Use the specified UUID as the seed for hashing, rather than generating a random seed each time. Intended for use with reproducible builds.

lazy_itable_init[=<0 to disable | 1 to enable>]

If enabled and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs. This speeds up file system initialization noticeably, but it requires the kernel to finish initializing the file system in the background when the file system is first mounted. If the option value is omitted, it defaults to 1 to enable lazy inode table zeroing.

lazy_journal_init[=<0 to disable | 1 to enable>]

If enabled, the journal inode will not be fully zeroed out by mke2fs. This speeds up file system initialization noticeably, but carries some small risk if the system crashes before the journal has been overwritten entirely one time. If the option value is omitted, it defaults to 1 to enable lazy journal inode zeroing.

mmp_update_interval=interval

Adjust the initial MMP update interval to interval seconds. Specifying an interval of 0 means to use the default interval. The specified interval must be less than 300 seconds. Requires that the mmp feature be enabled.

nodiscard

Do not attempt to discard blocks at mkfs time.

no_copy_xattrs

Normally mke2fs will copy the extended attributes of the files in the directory hierarchy specified via the (optional) -d option. This will disable the copy and leaves the files in the newly created file system without any extended attributes.

num_backup_sb=<0|1|2>

If the sparse_super2 file system feature is enabled this option controls whether there will be 0, 1, or 2 backup superblocks created in the file system.

offset=offset

Create the file system at an offset from the beginning of the device or file. This can be useful when creating disk images for virtual machines.

orphan_file_size=size

Set size of the file for tracking unlinked but still open inodes and inodes with truncate in progress. Larger file allows for better scalability, reserving a few blocks per CPU is ideal.

packed_meta_blocks[=<0 to disable | 1 to enable>]

Place the allocation bitmaps and the inode table at the beginning of the disk. This option requires that the flex_bg file system feature to be enabled in order for it to have effect, and will also create the journal at the beginning of the file system. This option is useful for flash devices that use SLC flash at the beginning of the disk. It also maximizes the range of contiguous data blocks, which can be useful for certain specialized use cases, such as supported Shingled Drives.

quotatype=quota-type[:...]

Specify the which quota types (usrquota, grpquota, prjquota) which should be enabled in the created file system. The argument of this extended option should be a colon separated list. This option has effect only if the quota feature is set. The default quota types to be initialized if this option is not specified is both user and group quotas. If the project feature is enabled then the project quotas will be initialized as well.

resize=max-online-resize

Reserve enough space so that the block group descriptor table can grow to support a file system that has max-online-resize blocks.

revision=fs-revision

Specify the file system revision number. Revision 0 file systems provide compatibility with pre-1.2 Linux kernels (dating from before 1995). This is only needed for testing or people who want to use very early, historical Linux systems. The current default (supported by all modern Linux systems) is revision 1.

root_owner[=uid:gid]

Specify the numeric user and group ID of the root directory. If no UID:GID is specified, use the user and group ID of the user running mke2fs. In mke2fs 1.42 and earlier the UID and GID of the root directory were set by default to the UID and GID of the user running the mke2fs command. The root_owner= option allows explicitly specifying these values, and avoid side-effects for users that do not expect the contents of the file system to change based on the user running mke2fs.

root_perms[=permissions]

Specify the root directory permissions in octal format. If no permissions are specified then the root directory permissions would be set in accordance with the default filesystem umask.

root_selinux=label

Specify the root directory SELinux security context as label, typically system_u:object_r:root_t with an optional level/range suffix such as :s0 for MCS/MLS policy types.

stride=stride-size

Configure the file system for a RAID array with stride-size file system blocks. This is the number of blocks read or written to disk before moving to the next disk, which is sometimes referred to as the chunk size. This mostly affects placement of file system metadata like bitmaps at mke2fs time to avoid placing them on a single disk, which can hurt performance. It may also be used by the block allocator.

stripe_width=stripe-width

Configure the file system for a RAID array with stripe-width file system blocks per stripe. This is typically stride-size * N, where N is the number of data-bearing disks in the RAID (e.g. for RAID 5 there is one parity disk, so N will be the number of disks in the array minus 1). This allows the block allocator to prevent read-modify-write of the parity in a RAID stripe if possible when the data is written.

test_fs

Set a flag in the file system superblock indicating that it may be mounted using experimental kernel code, such as the ext4dev file system.

-F

Force mke2fs to create a file system, even if the specified device is not a partition on a block special device, or if other parameters do not make sense. In order to force mke2fs to create a file system even if the file system appears to be in use or is mounted (a truly dangerous thing to do), this option must be specified twice.

-g blocks-per-group

Specify the number of blocks in a block group. There is generally no reason for the user to ever set this parameter, as the default is optimal for the file system. (For administrators who are creating file systems on RAID arrays, it is preferable to use the -E stride= extended option rather than manipulating the number of blocks per group.) This option is generally used by developers who are developing test cases.

If the bigalloc feature is enabled, the -g option will specify the number of clusters in a block group.

-G number-of-groups

Specify the number of block groups that will be packed together to create a larger virtual block group (or "flex_bg group") in an ext4 file system. This improves meta-data locality and performance on meta-data heavy workloads. The number of groups must be a power of 2 and may only be specified if the flex_bg file system feature is enabled.

-i bytes-per-inode

Specify the bytes/inode ratio. mke2fs creates an inode for every bytes-per-inode bytes of space on the disk. The larger the bytes-per-inode ratio, the fewer inodes will be created. This value generally shouldn't be smaller than the block-size of the file system, since in that case more inodes would be made than can ever be used. Be warned that it is not possible to change this ratio on a file system after it is created, so be careful deciding the correct value for this parameter. Note that resizing a file system changes the number of inodes to maintain this ratio.

-I inode-size

Specify the size of each inode in bytes. The inode-size value must be a power of 2 larger or equal to 128. The larger the inode-size the more space the inode table will consume, and this reduces the usable space in the file system and can also negatively impact performance. It is not possible to change this value after the file system is created.

File systems with an inode size of 128 bytes do not support timestamps beyond January 19, 2038. Inodes which are 256 bytes or larger will support extended timestamps, project id's, and the ability to store some extended attributes in the inode table for improved performance.

The default inode size is controlled by the mke2fs.conf(5) file. In the mke2fs.conf file shipped with e2fsprogs, the default inode size is 256 bytes for all file systems, except for the GNU Hurd since it only supports 128-byte inodes.

-j

Create the file system with an ext3 journal. If the -J option is not specified, the default journal parameters will be used to create an appropriately sized journal (given the size of the file system) stored within the file system. Note that you must be using a kernel which has ext3 support in order to actually make use of the journal.

-J journal-options

Create the ext3 journal using options specified on the command-line. Journal options are comma separated, and may take an argument using the equals ('=') sign. The following journal options are supported:

device=external-journal

Attach the file system to the journal block device located on external-journal. The external journal must already have been created using the command

mke2fs -O journal_dev external-journal

Note that external-journal must have been created with the same block size as the new file system. In addition, while there is support for attaching multiple file systems to a single external journal, the Linux kernel and e2fsck(8) do not currently support shared external journals yet.

Instead of specifying a device name directly, external-journal can also be specified by either LABEL=label or UUID=UUID to locate the external journal by either the volume label or UUID stored in the ext2 superblock at the start of the journal. Use dumpe2fs(8) to display a journal device's volume label and UUID. See also the -L option of tune2fs(8).

fast_commit_size=fast-commit-size

Create an additional fast commit journal area of size fast-commit-size kilobytes. This option is only valid if the fast_commit feature is enabled on the file system. If this option is not specified and if the fast_commit feature is turned on, fast commit area size defaults to journal-size / 64 megabytes. The total size of the journal with fast_commit feature set is journal-size + ( fast-commit-size * 1024 ) megabytes. The total journal size may be no more than 10,240,000 file system blocks or half the total file system size (whichever is smaller).

location=journal-location

Specify the location of the journal. The argument journal-location can either be specified as a block number, or if the number has a units suffix (e.g., 'M', 'G', etc.) interpret it as the offset from the beginning of the file system.

size=journal-size

Create an internal journal (i.e., stored inside the file system) of size journal-size megabytes. The size of the journal must be at least 1024 file system blocks (i.e., 1MB if using 1k blocks, 4MB if using 4k blocks, etc.) and may be no more than 10,240,000 file system blocks or half the total file system size (whichever is smaller)

Only one of the size or device options can be given for a file system.

-l filename

Read the bad blocks list from filename. Note that the block numbers in the bad block list must be generated using the same block size as used by mke2fs. As a result, the -c option to mke2fs is a much simpler and less error-prone method of checking a disk for bad blocks before formatting it, as mke2fs will automatically pass the correct parameters to the badblocks(8) program.

-L new-volume-label

Set the volume label for the file system to new-volume-label. The maximum length of the volume label is 16 bytes.

-m reserved-blocks-percentage

Specify the percentage of the file system blocks reserved for the super-user. This avoids fragmentation, and allows root-owned daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the file system. The default percentage is 5%.

-M last-mounted-directory

Set the last mounted directory for the file system. This might be useful for the sake of utilities that key off of the last mounted directory to determine where the file system should be mounted.

-n

Causes mke2fs to not actually create a file system, but display what it would do if it were to create a file system. This can be used to determine the location of the backup superblocks for a particular file system, so long as the mke2fs parameters that were passed when the file system was originally created are used again. (With the -n option added, of course!)

-N number-of-inodes

Overrides the default calculation of the number of inodes that should be reserved for the file system (which is based on the number of blocks and the bytes-per-inode ratio). This allows the user to specify the number of desired inodes directly.

-o creator-os

Overrides the default value of the "creator operating system" field of the file system. The creator field is set by default to the name of the OS the mke2fs executable was compiled for.

-O [^]feature[,...]

Create a file system with the given features (file system options), overriding the default file system options. The features that are enabled by default are specified by the base_features relation, either in the [defaults] section in the /etc/mke2fs.conf configuration file, or in the [fs_types] subsections for the usage types as specified by the -T option, further modified by the features relation found in the [fs_types] subsections for the file system and usage types. See the mke2fs.conf(5) manual page for more details. The file system type-specific configuration setting found in the [fs_types] section will override the global default found in [defaults]. The file system feature set will be further edited using either the feature set specified by this option, or if this option is not given, by the default_features relation for the file system type being created, or in the [defaults] section of the configuration file.

The file system feature set is comprised of a list of features, separated by commas, that are to be enabled. To disable a feature, simply prefix the feature name with a caret ('^') character. Features with dependencies will not be removed successfully. The pseudo-file system feature "none" will clear all file system features.

For more information about the features which can be set, please see the manual page ext4(5).

-q

Quiet execution. Useful if mke2fs is run in a script.

-S

Write superblock and group descriptors only. This is an extreme measure to be taken only in the very unlikely case that all of the superblock and backup superblocks are corrupted, and a last-ditch recovery method is desired by experienced users. It causes mke2fs to reinitialize the superblock and group descriptors, while not touching the inode table and the block and inode bitmaps. The e2fsck(8) program should be run immediately after this option is used, and there is no guarantee that any data will be salvageable. Due to the wide variety of possible options to mke2fs that affect the on-disk layout, it is critical to specify exactly the same format options, such as block-size, fs-type, feature flags, and other tunables when using this option, or the file system will be further corrupted. In some cases, such as file systems that have been resized, or have had features enabled after format time, it is impossible to overwrite all of the superblocks correctly, and at least some file system corruption will occur. It is best to run this on a full copy of the file system so other options can be tried if this doesn't work.

-t fs-type

Specify the file system type (i.e., ext2, ext3, ext4, etc.) that is to be created. If this option is not specified, mke2fs will pick a default either via how the command was run (for example, using a name of the form mkfs.ext2, mkfs.ext3, etc.) or via a default as defined by the /etc/mke2fs.conf file. This option controls which file system options are used by default, based on the [fs_types] configuration stanza in /etc/mke2fs.conf. If the -O option is used to explicitly add or remove file system options that should be set in the newly created file system, the resulting file system may not be supported by the requested fs-type. (e.g., "mke2fs -t ext3 -O extent /dev/sdXX" will create a file system that is not supported by the ext3 implementation as found in the Linux kernel; and "mke2fs -t ext3 -O ^has_journal /dev/hdXX" will create a file system that does not have a journal and hence will not be supported by the ext3 file system code in the Linux kernel.)

-T usage-type[,...]

Specify how the file system is going to be used, so that mke2fs can choose optimal file system parameters for that use. The usage types that are supported are defined in the configuration file /etc/mke2fs.conf(5). The user may specify one or more usage types using a comma separated list. If this option is is not specified, mke2fs will pick a single default usage type based on the size of the file system to be created. If the file system size is less than 3 megabytes, mke2fs will use the file system type floppy. If the file system size is greater than or equal to 3 but less than 512 megabytes, mke2fs will use the file system type small. If the file system size is greater than or equal to 4 terabytes but less than 16 terabytes, mke2fs will use the file system type big. If the file system size is greater than or equal to 16 terabytes, mke2fs will use the file system type huge. Otherwise, mke2fs will use the default file system type default.

-U UUID

Set the universally unique identifier (UUID) of the file system to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may also be one of the following:

clear

clear the file system UUID

random

generate a new randomly-generated UUID

time

generate a new time-based UUID

-v

Verbose execution.

-V

Print the version number of mke2fs and exit.

-z undo_file

Before overwriting a file system block, write the old contents of the block to an undo file. This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong. If the empty string is passed as the undo_file argument, the undo file will be written to a file named mke2fs-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable or the undo_dir directive in the configuration file. WARNING: The undo file cannot be used to recover from a power or system crash.

## ENVIRONMENT
MKE2FS_SYNC

If set to non-zero integer value, its value is used to determine how often sync(2) is called during inode table initialization.

MKE2FS_CONFIG

Determines the location of the configuration file (see mke2fs.conf(5)).

MKE2FS_FIRST_META_BG

If set to non-zero integer value, its value is used to determine first meta block group. This is mostly for debugging purposes.

MKE2FS_DEVICE_SECTSIZE

If set to non-zero integer value, its value is used to determine logical sector size of the device.

MKE2FS_DEVICE_PHYS_SECTSIZE

If set to non-zero integer value, its value is used to determine physical sector size of the device.

MKE2FS_SKIP_CHECK_MSG

If set, do not show the message of file system automatic check caused by mount count or check interval.

## AUTHOR
This version of mke2fs has been written by Theodore Ts'o <tytso@mit.edu>.

## AVAILABILITY
mke2fs is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

## SEE ALSO
mke2fs.conf(5), badblocks(8), dumpe2fs(8), e2fsck(8), tune2fs(8), ext4(5)


mklost+found

title: mklost+found(8)

text:
# mklost+found(8)

## NAME
mklost+found - create a lost+found directory on a mounted ext2/ext3/ext4 file system

## SYNOPSIS
mklost+found

## DESCRIPTION
mklost+found is used to create a lost+found directory in the current working directory on an ext2/ext3/ext4 file system. There is normally a lost+found directory in the root directory of each file system.

mklost+found pre-allocates disk blocks to the lost+found directory so that when e2fsck(8) is being run to recover a file system, it does not need to allocate blocks in the file system to store a large number of unlinked files. This ensures that e2fsck will not have to allocate data blocks in the file system during recovery.

## OPTIONS
There are none.

## AUTHOR
mklost+found has been written by Remy Card <Remy.Card@linux.org>. It is currently being maintained by Theodore Ts'o <tytso@alum.mit.edu>.

## BUGS
There are none :-)

## AVAILABILITY
mklost+found is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

## SEE ALSO
e2fsck(8), mke2fs(8)


title: resize2fs(8)

summary: ext2/ext3/ext4 file system resizer

text:
# resize2fs(8)

## NAME
resize2fs - ext2/ext3/ext4 file system resizer

## SYNOPSIS
resize2fs [ -fFpPMbs ] [ -d debug-flags ] [ -S RAID-stride ] [ -z undo_file ] device [ size ]

## DESCRIPTION
The resize2fs program will resize ext2, ext3, or ext4 file systems. It can be used to enlarge or shrink an unmounted file system located on device. If the file system is mounted, it can be used to expand the size of the mounted file system, assuming the kernel and the file system supports on-line resizing. (Modern Linux 2.6 kernels will support on-line resize for file systems mounted using ext3 and ext4; ext3 file systems will require the use of file systems with the resize_inode feature enabled.)

The size parameter specifies the requested new size of the file system. If no units are specified, the units of the size parameter shall be the file system blocksize of the file system. Optionally, the size parameter may be suffixed by one of the following units designators: 'K', 'M', 'G', 'T' (either upper-case or lower-case) or 's' for power-of-two kilobytes, megabytes, gigabytes, terabytes or 512 byte sectors respectively. The size of the file system may never be larger than the size of the partition. If size parameter is not specified, it will default to the size of the partition.

The resize2fs program does not manipulate the size of partitions. If you wish to enlarge a file system, you must make sure you can expand the size of the underlying partition first. This can be done using fdisk(8) by deleting the partition and recreating it with a larger size or using lvextend(8), if you're using the logical volume manager lvm(8). When recreating the partition, make sure you create it with the same starting disk cylinder as before! Otherwise, the resize operation will certainly not work, and you may lose your entire file system. After running fdisk(8), run resize2fs to resize the ext2 file system to use all of the space in the newly enlarged partition.

If you wish to shrink an ext2 partition, first use resize2fs to shrink the size of file system. Then you may use fdisk(8) to shrink the size of the partition. When shrinking the size of the partition, make sure you do not make it smaller than the new size of the ext2 file system!

The -b and -s options enable and disable the 64bit feature, respectively. The resize2fs program will, of course, take care of resizing the block group descriptors and moving other data blocks out of the way, as needed. It is not possible to resize the file system concurrent with changing the 64bit status.

## OPTIONS
-b

Turns on the 64bit feature, resizes the group descriptors as necessary, and moves other metadata out of the way.

-d debug-flags

Turns on various resize2fs debugging features, if they have been compiled into the binary. debug-flags should be computed by adding the numbers of the desired features from the following list:

2 - Debug block relocations

4 - Debug inode relocations

8 - Debug moving the inode table

16 - Print timing information

32 - Debug minimum file system size (-M) calculation

-f

Forces resize2fs to proceed with the file system resize operation, overriding some safety checks which resize2fs normally enforces.

-F

Flush the file system device's buffer caches before beginning. Only really useful for doing resize2fs time trials.

-M

Shrink the file system to minimize its size as much as possible, given the files stored in the file system.

-p

Print out percentage completion bars for each resize2fs phase during an offline (non-trivial) resize operation, so that the user can keep track of what the program is doing. (For very fast resize operations, no progress bars may be displayed.)

-P

Print an estimate of the number of file system blocks in the file system if it is shrunk using resize2fs's -M option and then exit.

-s

Turns off the 64bit feature and frees blocks that are no longer in use.

-S RAID-stride

The resize2fs program will heuristically determine the RAID stride that was specified when the file system was created. This option allows the user to explicitly specify a RAID stride setting to be used by resize2fs instead.

-z undo_file

Before overwriting a file system block, write the old contents of the block to an undo file. This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong. If the empty string is passed as the undo_file argument, the undo file will be written to a file named resize2fs-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable. WARNING: The undo file cannot be used to recover from a power or system crash.

## KNOWN BUGS
The minimum size of the file system as estimated by resize2fs may be incorrect, especially for file systems with 1k and 2k blocksizes.

## AUTHOR
resize2fs was written by Theodore Ts'o <tytso@mit.edu>.

## COPYRIGHT
Resize2fs is Copyright 1998 by Theodore Ts'o and PowerQuest, Inc. All rights reserved. As of April, 2000 Resize2fs may be redistributed under the terms of the GPL.

## SEE ALSO
fdisk(8), e2fsck(8), mke2fs(8), lvm(8), lvextend(8)


title: tune2fs(8)

text:
# tune2fs(8)

## NAME
tune2fs - adjust tunable file system parameters on ext2/ext3/ext4 file systems

## SYNOPSIS
tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ] [ -f ] [ -i interval-between-checks ] [ -I new_inode_size ] [ -j ] [ -J journal-options ] [ -m reserved-blocks-percentage ] [ -o [^]mount-options[,...] ] [ -r reserved-blocks-count ] [ -u user ] [ -g group ] [ -C mount-count ] [ -E extended-options ] [ -L volume-label ] [ -M last-mounted-directory ] [ -O [^]feature[,...] ] [ -Q quota-options ] [ -T time-last-checked ] [ -U UUID ] [ -z undo_file ] device

## DESCRIPTION
tune2fs allows the system administrator to adjust various tunable file system parameters on Linux ext2, ext3, or ext4 file systems. The current values of these options can be displayed by using the -l option to tune2fs(8) program, or by using the dumpe2fs(8) program.

The device specifier can either be a filename (i.e., /dev/sda1), or a LABEL or UUID specifier: "LABEL=volume-label" or "UUID=uuid". (i.e., LABEL=home or UUID=e40486c6-84d5-4f2f-b99c-032281799c9d).

## OPTIONS
-c max-mount-counts

Adjust the number of mounts after which the file system will be checked by e2fsck(8). If max-mount-counts is the string "random", tune2fs will use a random value between 20 and 40. If max-mount-counts is 0 or -1, the number of times the file system is mounted will be disregarded by e2fsck(8) and the kernel. Staggering the mount-counts at which file systems are forcibly checked will avoid all file systems being checked at one time when using journaled file systems.

Mount-count-dependent checking is disabled by default to avoid unanticipated long reboots while e2fsck(8) does its work. If you are concerned about file system corruptions caused by potential hardware problems of kernel bugs, a better solution than mount-count-dependent checking is to use the e2scrub(8) program. This does require placing the file system on an LVM volume, however.

-C mount-count

Set the number of times the file system has been mounted. If set to a greater value than the max-mount-counts parameter set by the -c option, e2fsck(8) will check the file system at the next reboot.

-e error-behavior

Change the behavior of the kernel code when errors are detected. In all cases, a file system error will cause e2fsck(8) to check the file system on the next boot. error-behavior can be one of the following:

continue

Continue normal execution.

remount-ro

Remount file system read-only.

panic

Cause a kernel panic.

-E extended-options

Set extended options for the file system. Extended options are comma separated, and may take an argument using the equals ('=') sign. The following extended options are supported:

clear_mmp

Reset the MMP block (if any) back to the clean state. Use only if absolutely certain the device is not currently mounted or being fscked, or major file system corruption can result. Needs -f.

encoding=encoding-name

Enable the casefold feature in the super block and set encoding-name as the encoding to be used. If encoding-name is not specified, "utf8" is used. The encoding cannot be altered if casefold was previously enabled.

encoding_flags=encoding-flags

Define parameters for file name character encoding operations. If a flag is not changed using this parameter, its default value is used. encoding-flags should be a comma-separated lists of flags to be enabled. The flags cannot be altered if casefold was previously enabled. The only flag that can be set right now is strict which means that invalid strings should be rejected by the file system. In the default configuration, the strict flag is disabled.

force_fsck

Set a flag in the file system superblock indicating that errors have been found. This will force fsck to run at the next mount.

hash_alg=hash-alg

Set the default hash algorithm used for file systems with hashed b-tree directories. Valid algorithms accepted are: legacy, half_md4, and tea.

mmp_update_interval=interval

Adjust the initial MMP update interval to interval seconds. Specifying an interval of 0 means to use the default interval. The specified interval must be less than 300 seconds. Requires that the mmp feature be enabled.

mount_opts=mount_option_string

Set a set of default mount options which will be used when the file system is mounted. Unlike the bitmask-based default mount options which can be specified with the -o option, mount_option_string is an arbitrary string with a maximum length of 63 bytes, which is stored in the superblock.

The ext4 file system driver will first apply the bitmask-based default options, and then parse the mount_option_string, before parsing the mount options passed from the mount(8) program.

This superblock setting is only honored in 2.6.35+ kernels; and not at all by the ext2 and ext3 file system drivers.

orphan_file_size=size

Set size of the file for tracking unlinked but still open inodes and inodes with truncate in progress. Larger file allows for better scalability, reserving a few blocks per CPU is ideal.

stride=stride-size

Configure the file system for a RAID array with stride-size file system blocks. This is the number of blocks read or written to disk before moving to next disk. This mostly affects placement of file system metadata like bitmaps at mke2fs(8) time to avoid placing them on a single disk, which can hurt the performance. It may also be used by block allocator.

stripe_width=stripe-width

Configure the file system for a RAID array with stripe-width file system blocks per stripe. This is typically be stride-size * N, where N is the number of data disks in the RAID (e.g. RAID 5 N+1, RAID 6 N+2). This allows the block allocator to prevent read-modify-write of the parity in a RAID stripe if possible when the data is written.

test_fs

Set a flag in the file system superblock indicating that it may be mounted using experimental kernel code, such as the ext4dev file system.

^test_fs

Clear the test_fs flag, indicating the file system should only be mounted using production-level file system code.

-f

Force the tune2fs operation to complete even in the face of errors. This option is useful when removing the has_journal file system feature from a file system which has an external journal (or is corrupted such that it appears to have an external journal), but that external journal is not available. If the file system appears to require journal replay, the -f flag must be specified twice to proceed. Warning: Removing an external journal from a file system which was not cleanly unmounted without first replaying the external journal can result in severe data loss and file system corruption.

-g group

Set the group which can use the reserved file system blocks. The group parameter can be a numerical gid or a group name. If a group name is given, it is converted to a numerical gid before it is stored in the superblock.

-i interval-between-checks[d|m|w]

Adjust the maximal time between two file system checks. No suffix or d will interpret the number interval-between-checks as days, m as months, and w as weeks. A value of zero will disable the time-dependent checking. There are pros and cons to disabling these periodic checks; see the discussion under the -c (mount-count-dependent check) option for details.

-I

Change the inode size used by the file system. This requires rewriting the inode table, so it requires that the file system is checked for consistency first using e2fsck(8). This operation can also take a while and the file system can be corrupted and data lost if it is interrupted while in the middle of converting the file system. Backing up the file system before changing inode size is recommended.

File systems with an inode size of 128 bytes do not support timestamps beyond January 19, 2038. Inodes which are 256 bytes or larger will support extended timestamps, project id's, and the ability to store some extended attributes in the inode table for improved performance.

-j

Add an ext3 journal to the file system. If the -J option is not specified, the default journal parameters will be used to create an appropriately sized journal (given the size of the file system) stored within the file system. Note that you must be using a kernel which has ext3 support in order to actually make use of the journal.

If this option is used to create a journal on a mounted file system, an immutable file, .journal, will be created in the top-level directory of the file system, as it is the only safe way to create the journal inode while the file system is mounted. While the ext3 journal is visible, it is not safe to delete it, or modify it while the file system is mounted; for this reason the file is marked immutable. While checking unmounted file systems, e2fsck(8) will automatically move .journal files to the invisible, reserved journal inode. For all file systems except for the root file system, this should happen automatically and naturally during the next reboot cycle. Since the root file system is mounted read-only, e2fsck(8) must be run from a rescue floppy in order to effect this transition.

On some distributions, such as Debian, if an initial ramdisk is used, the initrd scripts will automatically convert an ext2 root file system to ext3 if the /etc/fstab(5) file specifies the ext3 file system for the root file system in order to avoid requiring the use of a rescue floppy to add an ext3 journal to the root file system.

-J journal-options

Override the default ext3 journal parameters. Journal options are comma separated, and may take an argument using the equals ('=') sign. The following journal options are supported:

device=external-journal

Attach the file system to the journal block device located on external-journal. The external journal must have been already created using the command

mke2fs -O journal_dev external-journal

Note that external-journal must be formatted with the same block size as file systems which will be using it. In addition, while there is support for attaching multiple file systems to a single external journal, the Linux kernel and e2fsck(8) do not currently support shared external journals yet.

Instead of specifying a device name directly, external-journal can also be specified by either LABEL=label or UUID=UUID to locate the external journal by either the volume label or UUID stored in the ext2 superblock at the start of the journal. Use dumpe2fs(8) to display a journal device's volume label and UUID. See also the -L option of tune2fs(8).

fast_commit_size=fast-commit-size

Create an additional fast commit journal area of size fast-commit-size kilobytes. This option is only valid if fast_commit feature is enabled on the file system. If this option is not specified and if fast_commit feature is turned on, fast commit area size defaults to journal-size / 64 megabytes. The total size of the journal with fast_commit feature set is journal-size + ( fast-commit-size * 1024 ) megabytes. The total journal size may be no more than 10,240,000 file system blocks or half the total file system size (whichever is smaller).

location=journal-location

Specify the location of the journal. The argument journal-location can either be specified as a block number, or if the number has a units suffix (e.g., 'M', 'G', etc.) interpret it as the offset from the beginning of the file system.

size=journal-size

Create a journal stored in the file system of size journal-size megabytes. The size of the journal must be at least 1024 file system blocks (i.e., 1 MiB if using 1k blocks, 4 MiB if using 4k blocks, etc.) and may be no more than 10,240,000 file system blocks. There must be enough free space in the file system to create a journal of that size.

Only one of the size or device options can be given for a file system.

-l

List the contents of the file system superblock, including the current values of the parameters that can be set via this program.

-L volume-label

Set the volume label of the file system. Ext2 file system labels can be at most 16 characters long; if volume-label is longer than 16 characters, tune2fs will truncate it and print a warning. For other file systems that support online label manipulation and are mounted tune2fs will work as well, but it will not attempt to truncate the volume-label at all. The volume label can be used by mount(8), fsck(8), and /etc/fstab(5) (and possibly others) by specifying LABEL=volume-label instead of a block special device name like /dev/hda5.

-m reserved-blocks-percentage

Set the percentage of the file system which may only be allocated by privileged processes. Reserving some number of file system blocks for use by privileged processes is done to avoid file system fragmentation, and to allow system daemons, such as syslogd(8), to continue to function correctly after non-privileged processes are prevented from writing to the file system. Normally, the default percentage of reserved blocks is 5%.

-M last-mounted-directory

Set the last-mounted directory for the file system.

-o [^]mount-option[,...]

Set or clear the indicated default mount options in the file system. Default mount options can be overridden by mount options specified either in /etc/fstab(5) or on the command line arguments to mount(8). Older kernels may not support this feature; in particular, kernels which predate 2.4.20 will almost certainly ignore the default mount options field in the superblock.

More than one mount option can be cleared or set by separating features with commas. Mount options prefixed with a caret character ('^') will be cleared in the file system's superblock; mount options without a prefix character or prefixed with a plus character ('+') will be added to the file system.

The following mount options can be set or cleared using tune2fs:

debug

Enable debugging code for this file system.

bsdgroups

Emulate BSD behavior when creating new files: they will take the group-id of the directory in which they were created. The standard System V behavior is the default, where newly created files take on the fsgid of the current process, unless the directory has the setgid bit set, in which case it takes the gid from the parent directory, and also gets the setgid bit set if it is a directory itself.

user_xattr

Enable user-specified extended attributes.

acl

Enable Posix Access Control Lists.

uid16

Disables 32-bit UIDs and GIDs. This is for interoperability with older kernels which only store and expect 16-bit values.

journal_data

When the file system is mounted with journaling enabled, all data (not just metadata) is committed into the journal prior to being written into the main file system.

journal_data_ordered

When the file system is mounted with journaling enabled, all data is forced directly out to the main file system prior to its metadata being committed to the journal.

journal_data_writeback

When the file system is mounted with journaling enabled, data may be written into the main file system after its metadata has been committed to the journal. This may increase throughput, however, it may allow old data to appear in files after a crash and journal recovery.

nobarrier

The file system will be mounted with barrier operations in the journal disabled. (This option is currently only supported by the ext4 file system driver in 2.6.35+ kernels.)

block_validity

The file system will be mounted with the block_validity option enabled, which causes extra checks to be performed after reading or writing from the file system. This prevents corrupted metadata blocks from causing file system damage by overwriting parts of the inode table or block group descriptors. This comes at the cost of increased memory and CPU overhead, so it is enabled only for debugging purposes. (This option is currently only supported by the ext4 file system driver in 2.6.35+ kernels.)

discard

The file system will be mounted with the discard mount option. This will cause the file system driver to attempt to use the trim/discard feature of some storage devices (such as SSD's and thin-provisioned drives available in some enterprise storage arrays) to inform the storage device that blocks belonging to deleted files can be reused for other purposes. (This option is currently only supported by the ext4 file system driver in 2.6.35+ kernels.)

nodelalloc

The file system will be mounted with the nodelalloc mount option. This will disable the delayed allocation feature. (This option is currently only supported by the ext4 file system driver in 2.6.35+ kernels.)

-O [^]feature[,...]

Set or clear the indicated file system features (options) in the file system. More than one file system feature can be cleared or set by separating features with commas. File System features prefixed with a caret character ('^') will be cleared in the file system's superblock; file system features without a prefix character or prefixed with a plus character ('+') will be added to the file system. For a detailed description of the file system features, please see the man page ext4(5).

The following file system features can be set or cleared using tune2fs:

64bit

Enable the file system to be larger than 2^32 blocks.

casefold

Enable support for file system level casefolding. The option can be cleared only if filesystem has no directories with F attribute.

dir_index

Use hashed b-trees to speed up lookups for large directories.

dir_nlink

Allow more than 65000 subdirectories per directory.

ea_inode

Allow the value of each extended attribute to be placed in the data blocks of a separate inode if necessary, increasing the limit on the size and number of extended attributes per file. tune2fs currently only supports setting this file system feature.

encrypt

Enable support for file system level encryption. tune2fs currently only supports setting this file system feature.

extent

Enable the use of extent trees to store the location of data blocks in inodes. tune2fs currently only supports setting this file system feature.

extra_isize

Enable the extended inode fields used by ext4.

filetype

Store file type information in directory entries.

flex_bg

Allow bitmaps and inode tables for a block group to be placed anywhere on the storage media. tune2fs will not reorganize the location of the inode tables and allocation bitmaps, as mke2fs(8) will do when it creates a freshly formatted file system with flex_bg enabled.

has_journal

Use a journal to ensure file system consistency even across unclean shutdowns. Setting the file system feature is equivalent to using the -j option.

fast_commit

Enable fast commit journaling feature to improve fsync latency.

large_dir

Increase the limit on the number of files per directory. tune2fs currently only supports setting this file system feature.

huge_file

Support files larger than 2 terabytes in size.

large_file

File System can contain files that are greater than 2 GiB.

metadata_csum

Store a checksum to protect the contents in each metadata block.

metadata_csum_seed

Allow the file system to store the metadata checksum seed in the superblock, enabling the administrator to change the UUID of a file system using the metadata_csum feature while it is mounted.

mmp

Enable or disable multiple mount protection (MMP) feature.

orphan_file

Store the list of orphan inodes in multiple blocks instead of a single linked-list to avoid potential scalability bottlenecks for workloads that perform a large number of file truncations or extensions in parallel.

project

Enable project ID tracking. This is used for project quota tracking.

quota

Enable internal file system quota inodes.

read-only

Force the kernel to mount the file system read-only.

resize_inode

Reserve space so the block group descriptor table may grow in the future. tune2fs only supports clearing this file system feature.

sparse_super

Limit the number of backup superblocks to save space on large file systems. tune2fs currently only supports setting this file system feature.

stable_inodes

Prevent the file system from being shrunk or having its UUID changed, in order to allow the use of specialized encryption settings that make use of the inode numbers and UUID. tune2fs currently only supports setting this file system feature.

uninit_bg

Allow the kernel to initialize bitmaps and inode tables lazily, and to keep a high watermark for the unused inodes in a file system, to reduce e2fsck(8) time. The first e2fsck(8) run after enabling this feature will take the full time, but subsequent e2fsck(8) runs will take only a fraction of the original time, depending on how full the file system is.

verity

Enable support for verity protected files. tune2fs currently only supports setting this file system feature.

After setting or clearing sparse_super, uninit_bg, filetype, or resize_inode file system features, the file system may require being checked using e2fsck(8) to return the file system to a consistent state. tune2fs will print a message requesting that the system administrator run e2fsck(8) if necessary. After setting the dir_index feature, e2fsck -D can be run to convert existing directories to the hashed B-tree format. Enabling certain file system features may prevent the file system from being mounted by kernels which do not support those features. In particular, the uninit_bg and flex_bg features are only supported by the ext4 file system.

-r reserved-blocks-count

Set the number of reserved file system blocks.

-Q quota-options

Sets the quota feature on the superblock and works on the quota files for the given quota type. Quota options could be one or more of the following:

[^]usrquota

Sets/clears user quota inode in the superblock.

[^]grpquota

Sets/clears group quota inode in the superblock.

[^]prjquota

Sets/clears project quota inode in the superblock.

-T time-last-checked

Set the time the file system was last checked using e2fsck. The time is interpreted using the current (local) timezone. This can be useful in scripts which use a Logical Volume Manager to make a consistent snapshot of a file system, and then check the file system during off hours to make sure it hasn't been corrupted due to hardware problems, etc. If the file system was clean, then this option can be used to set the last checked time on the original file system. The format of time-last-checked is the international date format, with an optional time specifier, i.e. YYYYMMDD[HH[MM[SS]]]. The keyword now is also accepted, in which case the last checked time will be set to the current time.

-u user

Set the user who can use the reserved file system blocks. user can be a numerical uid or a user name. If a user name is given, it is converted to a numerical uid before it is stored in the superblock.

-U UUID

Set the universally unique identifier (UUID) of the file system to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this: "c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may also be one of the following:

clear

clear the file system UUID

random

generate a new randomly-generated UUID

time

generate a new time-based UUID

The UUID may be used by mount(8), fsck(8), and /etc/fstab(5) (and possibly others) by specifying UUID=uuid instead of a block special device name like /dev/hda1.

See uuidgen(8) for more information. If the system does not have a good random number generator such as /dev/random or /dev/urandom, tune2fs will automatically use a time-based UUID instead of a randomly-generated UUID.

-z undo_file

Before overwriting a file system block, write the old contents of the block to an undo file. This undo file can be used with e2undo(8) to restore the old contents of the file system should something go wrong. If the empty string is passed as the undo_file argument, the undo file will be written to a file named tune2fs-device.e2undo in the directory specified via the E2FSPROGS_UNDO_DIR environment variable. WARNING: The undo file cannot be used to recover from a power or system crash.

## BUGS
We haven't found any bugs yet. That doesn't mean there aren't any...

## AUTHOR
tune2fs was written by Remy Card <Remy.Card@linux.org>. It is currently being maintained by Theodore Ts'o <tytso@alum.mit.edu>. tune2fs uses the ext2fs library written by Theodore Ts'o <tytso@mit.edu>. This manual page was written by Christian Kuhtz <chk@data-hh.Hanse.DE>. Time-dependent checking was added by Uwe Ohse <uwe@tirka.gun.de>.

## AVAILABILITY
tune2fs is part of the e2fsprogs package and is available from http://e2fsprogs.sourceforge.net.

## SEE ALSO
debugfs(8), dumpe2fs(8), e2fsck(8), mke2fs(8), ext4(5)