.\" -*- nroff -*-
.\" Copyright 1993, 1994, 1995 by Theodore Ts'o.  All Rights Reserved.
.\" This file may be copied under the terms of the GNU Public License.
.\"
.TH EXT4 5 "@E2FSPROGS_MONTH@ @E2FSPROGS_YEAR@" "E2fsprogs version @E2FSPROGS_VERSION@"
.SH NAME
ext2 \- the second extended file system
.br
ext3 \- the third extended file system
.br
ext4 \- the fourth extended file system
.SH DESCRIPTION
The second, third, and fourth extended file systems, or ext2, ext3, and
ext4 as they are commonly known, are Linux file systems that have
historically been the default file system for many Linux distributions.
They are general purpose file systems that have been designed for
extensibility and backwards compatibility.  In particular, file systems
previously intended for use with the ext2 and ext3 file systems can be
mounted using the ext4 file system driver, and indeed in many modern
Linux distributions, the ext4 file system driver has been configured
to handle mount requests for ext2 and ext3 file systems.
.SH FILE SYSTEM FEATURES
A file system formatted for ext2, ext3, or ext4 can have some
collection of the following file system feature flags enabled.  Some of
these features are not supported by all implementations of the ext2,
ext3, and ext4 file system drivers, depending on Linux kernel version in
use.  On other operating systems, such as the GNU/HURD or FreeBSD, only
a very restrictive set of file system features may be supported in their
implementations of ext2.
.TP
.B 64bit
.br
Enables the file system to be larger than 2^32 blocks.  This feature is set
automatically, as needed, but it can be useful to specify this feature
explicitly if the file system might need to be resized larger than 2^32
blocks, even if it was smaller than that threshold when it was
originally created.  Note that some older kernels and older versions
of e2fsprogs will not support file systems with this ext4 feature enabled.
.TP
.B bigalloc
.br
This ext4 feature enables clustered block allocation, so that the unit of
allocation is a power of two number of blocks.  That is, each bit in the
what had traditionally been known as the block allocation bitmap now
indicates whether a cluster is in use or not, where a cluster is by
default composed of 16 blocks.  This feature can decrease the time
spent on doing block allocation and brings smaller fragmentation, especially
for large files.  The size can be specified using the
.B mke2fs \-C
option.
.IP
.B Warning:
The bigalloc feature is still under development, and may not be fully
supported with your kernel or may have various bugs.  Please see the web
page http://ext4.wiki.kernel.org/index.php/Bigalloc for details.
May clash with delayed allocation (see
.B nodelalloc
mount option).
.IP
This feature requires that the
.B extent
feature be enabled.
.TP
.B dir_index
.br
Use hashed b-trees to speed up name lookups in large directories.  This
feature is supported by ext3 and ext4 file systems, and is ignored by
ext2 file systems.
.TP
.B dir_nlink
.br
This ext4 feature allows more than 65000 subdirectories per directory.
.TP
.B encrypt
.br
This ext4 feature provides file-system level encryption of data blocks
and file names.  The inode metadata (timestamps, file size, user/group
ownership, etc.) is
.I not
encrypted.
.IP
This feature is most useful on file systems with multiple users, or
where not all files should be encrypted.  In many use cases, especially
on single-user systems, encryption at the block device layer using
dm-crypt may provide much better security.
.TP
.B ext_attr
.br
This feature enables the use of extended attributes.  This feature is
supported by ext2, ext3, and ext4.
.TP
.B extent
.br
This ext4 feature allows the mapping of logical block numbers for a
particular inode to physical blocks on the storage device to be stored
using an extent tree, which is a more efficient data structure than the
traditional indirect block scheme used by the ext2 and ext3 file
systems.  The use of the extent tree decreases metadata block overhead,
improves file system performance, and decreases the needed to run
.BR e2fsck (8)
on the file system.
(Note: both
.B extent
and
.B extents
are accepted as valid names for this feature for
historical/backwards compatibility reasons.)
.TP
.B extra_isize
.br
This ext4 feature reserves a specific amount of space in each inode for
extended metadata such as nanosecond timestamps and file creation time,
even if the current kernel does not currently need to reserve this much
space.  Without this feature, the kernel will reserve the amount of
space for features it currently needs, and the rest may be
consumed by extended attributes.

For this feature to be useful the inode size must be 256 bytes in size
or larger.
.TP
.B filetype
.br
This feature enables the storage of file type information in directory
entries.  This feature is supported by ext2, ext3, and ext4.
.TP
.B flex_bg
.br
This ext4 feature allows the per-block group metadata (allocation
bitmaps
and inode tables)
to be placed anywhere on the storage media.  In addition,
.B mke2fs
will place the per-block group metadata together starting at the first
block group of each "flex_bg group".   The size of the flex_bg group
can be specified using the
.B \-G
option.
.TP
.B has_journal
.br
Create a journal to ensure filesystem consistency even across unclean
shutdowns.  Setting the filesystem feature is equivalent to using the
.B \-j
option with
.BR mke2fs " or " tune2fs.
This feature is supported by ext3 and ext4, and ignored by the
ext2 file system driver.
.TP
.B huge_file
.br
This ext4 feature allows files to be larger than 2 terabytes in size.
.TP
.B inline_data
Allow data to be stored in the inode and extended attribute area.
.TP
.B journal_dev
.br
This feature is enabled on the superblock found on an external journal
device.  The block size for the external journal must be the same as the
file system which uses it.
.IP
The external journal device can be used by a file system by specifying
the
.B \-J
.BR device= <external-device>
option to
.BR mke2fs (8)
or
.BR tune2fs(8).
.TP
.B large_file
.br
This feature flag is set automatically by modern kernels when a file
larger than 2 gigabytes is created.  Very old kernels could not
handle large files, so this feature flag was used to prohibit those
kernels from mounting file systems that they could not understand.
.\" .TP
.\" .B metadata_csum
.\" .br
.\" This ext4 feature enables metadata checksumming.  This feature stores
.\" checksums for all of the filesystem metadata (superblock, group
.\" descriptor blocks, inode and block bitmaps, directories, and
.\" extent tree blocks).  The checksum algorithm used for the metadata
.\" blocks is different than the one used for group descriptors with the
.\" .B uninit_bg
.\" feature, these two features are incompatible and
.\" .B metadata_csum
.\" will be used preferentially instead of
.\" .BR uninit_bg .
.\" .br
.\" .B Future feature, available in e2fsprogs 1.43-WIP
.TP
.B meta_bg
.br
This ext4 feature allows file systems to be resized on-line without explicitly
needing to reserve space for growth in the size of the block group
descriptors.  This scheme is also used to resize file systems which are
larger than 2^32 blocks.  It is not recommended that this feature be set
when a file system is created, since this alternate method of storing
the block group descriptors will slow down the time needed to mount the
file system, and newer kernels can automatically set this feature as
necessary when doing an online resize and no more reserved space is
available in the resize inode.
.TP
.B mmp
.br
This ext4 feature provides multiple mount protection (MMP).  MMP helps to
protect the filesystem from being multiply mounted and is useful in
shared storage environments.
.IP
Causes the quota files (i.e., user.quota and
group.quota which existed
in the older quota design) to be hidden inodes.
.TP
.B project
.br
This ext4 feature provides project quota support. With this feature,
the project ID of inode will be managed when the filesystem is mounted.
.TP
.B quota
.br
Create quota inodes (inode #3 for userquota and inode
#4 for group quota) and set them in the superblock.
With this feature, the quotas will be enabled
automatically when the filesystem is mounted.
.TP
.B resize_inode
.br
This file system feature indicates that space has been reserved so that
the block group descriptor table can be extended while resizing a mounted
file system.  The online resize operation
is carried out by the kernel, triggered by
.BR resize2fs (8).
By default
.B mke2fs
will attempt to reserve enough space so that the
filesystem may grow to 1024 times its initial size.  This can be changed
using the
.B resize
extended option.
.IP
This feature requires that the
.B sparse_super
feature be enabled.
.TP
.B sparse_super
.br
This file system feature is set on all modern ext2, ext3, and ext4 file
systems.  It indicates that backup copies of the superblock and block
group descriptors are present only in a few block groups, not all of
them.
.TP
.B sparse_super2
.br
This feature indicates that there will only be at most two backup
superblocks and block group descriptors.  The block groups used to store
the backup superblock(s) and blockgroup descriptor(s) are stored in the
superblock, but typically, one will be located at the beginning of block
group #1, and one in the last block group in the file system.  This
feature is essentially a more extreme version of sparse_super and is
designed to allow a much larger percentage of the disk to have
contiguous blocks available for data files.
.TP
.B uninit_bg
.br
This ext4 file system feature indicates that the block group descriptors
will be protected using checksums, making it safe for
.BR mke2fs (8)
to create a file system without initializing all of the block groups.
The kernel will keep a high watermark of unused inodes, and initialize
inode tables and blocks lazily.  This feature speeds up the time to check
the file system using
.BR e2fsck (8),
and it also speeds up the time required for
.BR mke2fs (8)
to create the file system.
.SH MOUNT OPTIONS
This section describes mount options which are specific to ext2, ext3,
and ext4.  Other generic mount options may be used as well; see
.BR mount (8)
for details.
.SH "Mount options for ext2"
The `ext2' filesystem is the standard Linux filesystem.
Since Linux 2.5.46, for most mount options the default
is determined by the filesystem superblock. Set them with
.BR tune2fs (8).
.TP
.BR acl | noacl
Support POSIX Access Control Lists (or not).  See the
.BR acl (5)
manual page.
.TP
.BR bsddf | minixdf
Set the behavior for the
.I statfs
system call. The
.B minixdf
behavior is to return in the
.I f_blocks
field the total number of blocks of the filesystem, while the
.B bsddf
behavior (which is the default) is to subtract the overhead blocks
used by the ext2 filesystem and not available for file storage. Thus
.sp 1
% mount /k \-o minixdf; df /k; umount /k
.TS
tab(#);
l2 l2 r2 l2 l2 l
l c r c c l.
Filesystem#1024-blocks#Used#Available#Capacity#Mounted on
/dev/sda6#2630655#86954#2412169#3%#/k
.TE
.sp 1
% mount /k \-o bsddf; df /k; umount /k
.TS
tab(#);
l2 l2 r2 l2 l2 l
l c r c c l.
Filesystem#1024-blocks#Used#Available#Capacity#Mounted on
/dev/sda6#2543714#13#2412169#0%#/k
.TE
.sp 1
(Note that this example shows that one can add command line options
to the options given in
.IR /etc/fstab .)
.TP
.BR check=none " or " nocheck
No checking is done at mount time. This is the default. This is fast.
It is wise to invoke
.BR e2fsck (8)
every now and then, e.g.\& at boot time. The non-default behavior is unsupported
(check=normal and check=strict options have been removed). Note that these mount options
don't have to be supported if ext4 kernel driver is used for ext2 and ext3 filesystems.
.TP
.B debug
Print debugging info upon each (re)mount.
.TP
.BR errors= { continue | remount-ro | panic }
Define the behavior when an error is encountered.
(Either ignore errors and just mark the filesystem erroneous and continue,
or remount the filesystem read-only, or panic and halt the system.)
The default is set in the filesystem superblock, and can be
changed using
.BR tune2fs (8).
.TP
.BR grpid | bsdgroups " and " nogrpid | sysvgroups
These options define what group id a newly created file gets.
When
.B grpid
is set, it takes the group id of the directory in which it is created;
otherwise (the default) it takes 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.
.TP
.BR grpquota | noquota | quota | usrquota
The usrquota (same as quota) mount option enables user quota support on the
filesystem. grpquota enables group quotas support. You need the quota utilities
to actually enable and manage the quota system.
.TP
.B nouid32
Disables 32-bit UIDs and GIDs.  This is for interoperability with older
kernels which only store and expect 16-bit values.
.TP
.BR oldalloc " or " orlov
Use old allocator or Orlov allocator for new inodes. Orlov is default.
.TP
\fBresgid=\fP\,\fIn\fP and \fBresuid=\fP\,\fIn\fP
The ext2 filesystem reserves a certain percentage of the available
space (by default 5%, see
.BR mke2fs (8)
and
.BR tune2fs (8)).
These options determine who can use the reserved blocks.
(Roughly: whoever has the specified uid, or belongs to the specified group.)
.TP
.BI sb= n
Instead of block 1, use block
.I n
as superblock. This could be useful when the filesystem has been damaged.
(Earlier, copies of the superblock would be made every 8192 blocks: in
block 1, 8193, 16385, \&...\& (and one got thousands of copies on
a big filesystem). Since version 1.08,
.B mke2fs
has a \-s (sparse superblock) option to reduce the number of backup
superblocks, and since version 1.15 this is the default. Note
that this may mean that ext2 filesystems created by a recent
.B mke2fs
cannot be mounted r/w under Linux 2.0.*.)
The block number here uses 1\ k units. Thus, if you want to use logical
block 32768 on a filesystem with 4\ k blocks, use "sb=131072".
.TP
.BR user_xattr | nouser_xattr
Support "user." extended attributes (or not).


.SH "Mount options for ext3"
The ext3 filesystem is a version of the ext2 filesystem which has been
enhanced with journaling.  It supports the same options as ext2 as
well as the following additions:
.TP
.BR journal_dev=devnum / journal_path=path
When the external journal device's major/minor numbers
have changed, these options allow the user to specify
the new journal location.  The journal device is
identified either through its new major/minor numbers encoded
in devnum, or via a path to the device.
.TP
.BR norecovery / noload
Don't load the journal on mounting.  Note that
if the filesystem was not unmounted cleanly,
skipping the journal replay will lead to the
filesystem containing inconsistencies that can
lead to any number of problems.
.TP
.BR data= { journal | ordered | writeback }
Specifies the journaling mode for file data.  Metadata is always journaled.
To use modes other than
.B ordered
on the root filesystem, pass the mode to the kernel as boot parameter, e.g.\&
.IR rootflags=data=journal .
.RS
.TP
.B journal
All data is committed into the journal prior to being written into the
main filesystem.
.TP
.B ordered
This is the default mode.  All data is forced directly out to the main file
system prior to its metadata being committed to the journal.
.TP
.B writeback
Data ordering is not preserved \(en data may be written into the main
filesystem after its metadata has been committed to the journal.
This is rumoured to be the highest-throughput option.  It guarantees
internal filesystem integrity, however it can allow old data to appear
in files after a crash and journal recovery.
.RE
.TP
.B data_err=ignore
Just print an error message if an error occurs in a file data buffer in
ordered mode.
.TP
.B data_err=abort
Abort the journal if an error occurs in a file data buffer in ordered mode.
.TP
.BR barrier=0 " / " barrier=1 "
This disables / enables the use of write barriers in the jbd code.  barrier=0
disables, barrier=1 enables (default). This also requires an IO stack which can
support barriers, and if jbd gets an error on a barrier write, it will disable
barriers again with a warning.  Write barriers enforce proper on-disk ordering
of journal commits, making volatile disk write caches safe to use, at some
performance penalty.  If your disks are battery-backed in one way or another,
disabling barriers may safely improve performance.
.TP
.BI commit= nrsec
Sync all data and metadata every
.I nrsec
seconds. The default value is 5 seconds. Zero means default.
.TP
.B user_xattr
Enable Extended User Attributes. See the
.BR attr (5)
manual page.
.TP
.BR usrjquota=aquota.user | grpjquota=aquota.group | jqfmt=vfsv0
Apart from the old quota system (as in ext2, jqfmt=vfsold aka version 1 quota)
ext3 also supports journaled quotas (version 2 quota). jqfmt=vfsv0
enables journaled quotas. For journaled quotas the mount options
usrjquota=aquota.user and grpjquota=aquota.group are required to tell the
quota system which quota database files to use. Journaled quotas have the
advantage that even after a crash no quota check is required.

.SH "Mount options for ext4"
The ext4 filesystem is an advanced level of the ext3 filesystem which
incorporates scalability and reliability enhancements for supporting large
filesystem.

The options
.B journal_dev, norecovery, noload, data, commit, orlov, oldalloc, [no]user_xattr
.B [no]acl, bsddf, minixdf, debug, errors, data_err, grpid, bsdgroups, nogrpid
.B sysvgroups, resgid, resuid, sb, quota, noquota, nouid32, grpquota, usrquota
.B usrjquota, grpjquota and jqfmt
are backwardly compatible with ext3 or ext2.
.TP
.B journal_checksum
Enable checksumming of the journal transactions.  This will allow the recovery
code in e2fsck and the kernel to detect corruption in the kernel.  It is a
compatible change and will be ignored by older kernels.
.TP
.B journal_async_commit
Commit block can be written to disk without waiting for descriptor blocks. If
enabled older kernels cannot mount the device.
This will enable 'journal_checksum' internally.
.TP
.BR barrier=0 " / " barrier=1 " / " barrier " / " nobarrier
These mount options have the same effect as in ext3.  The mount options
"barrier" and "nobarrier" are added for consistency with other ext4 mount
options.

The ext4 filesystem enables write barriers by default.
.TP
.BI inode_readahead_blks= n
This tuning parameter controls the maximum number of inode table blocks that
ext4's inode table readahead algorithm will pre-read into the buffer cache.
The value must be a power of 2. The default value is 32 blocks.
.TP
.BI stripe= n
Number of filesystem blocks that mballoc will try to use for allocation size
and alignment. For RAID5/6 systems this should be the number of data disks *
RAID chunk size in filesystem blocks.
.TP
.B delalloc
Deferring block allocation until write-out time.
.TP
.B nodelalloc
Disable delayed allocation. Blocks are allocated when data is copied from user
to page cache.
.TP
.BI max_batch_time= usec
Maximum amount of time ext4 should wait for additional filesystem operations to
be batch together with a synchronous write operation. Since a synchronous
write operation is going to force a commit and then a wait for the I/O
complete, it doesn't cost much, and can be a huge throughput win, we wait for a
small amount of time to see if any other transactions can piggyback on the
synchronous write. The algorithm used is designed to automatically tune for
the speed of the disk, by measuring the amount of time (on average) that it
takes to finish committing a transaction. Call this time the "commit time".
If the time that the transaction has been running is less than the commit time,
ext4 will try sleeping for the commit time to see if other operations will join
the transaction. The commit time is capped by the max_batch_time, which
defaults to 15000\ \[mc]s (15\ ms). This optimization can be turned off entirely by
setting max_batch_time to 0.
.TP
.BI min_batch_time= usec
This parameter sets the commit time (as described above) to be at least
min_batch_time. It defaults to zero microseconds. Increasing this parameter
may improve the throughput of multi-threaded, synchronous workloads on very
fast disks, at the cost of increasing latency.
.TP
.BI journal_ioprio= prio
The I/O priority (from 0 to 7, where 0 is the highest priority) which should be
used for I/O operations submitted by kjournald2 during a commit operation.
This defaults to 3, which is a slightly higher priority than the default I/O
priority.
.TP
.B abort
Simulate the effects of calling ext4_abort() for
debugging purposes.  This is normally used while
remounting a filesystem which is already mounted.
.TP
.BR auto_da_alloc | noauto_da_alloc
Many broken applications don't use fsync() when
replacing existing files via patterns such as

fd = open("foo.new")/write(fd,...)/close(fd)/ rename("foo.new", "foo")

or worse yet

fd = open("foo", O_TRUNC)/write(fd,...)/close(fd).

If auto_da_alloc is enabled, ext4 will detect the replace-via-rename and
replace-via-truncate patterns and force that any delayed allocation blocks are
allocated such that at the next journal commit, in the default data=ordered
mode, the data blocks of the new file are forced to disk before the rename()
operation is committed.  This provides roughly the same level of guarantees as
ext3, and avoids the "zero-length" problem that can happen when a system
crashes before the delayed allocation blocks are forced to disk.
.TP
.B noinit_itable
Do not initialize any uninitialized inode table blocks in the background. This
feature may be used by installation CD's so that the install process can
complete as quickly as possible; the inode table initialization process would
then be deferred until the next time the filesystem is mounted.
.TP
.B init_itable=n
The lazy itable init code will wait n times the number of milliseconds it took
to zero out the previous block group's inode table. This minimizes the impact on
system performance while the filesystem's inode table is being initialized.
.TP
.BR discard / nodiscard
Controls whether ext4 should issue discard/TRIM commands to the underlying
block device when blocks are freed.  This is useful for SSD devices and
sparse/thinly-provisioned LUNs, but it is off by default until sufficient
testing has been done.
.TP
.BR block_validity / noblock_validity
This options enables/disables the in-kernel facility for tracking
filesystem metadata blocks within internal data structures. This allows multi-\c
block allocator and other routines to quickly locate extents which might
overlap with filesystem metadata blocks. This option is intended for debugging
purposes and since it negatively affects the performance, it is off by default.
.TP
.BR dioread_lock / dioread_nolock
Controls whether or not ext4 should use the DIO read locking. If the
dioread_nolock option is specified ext4 will allocate uninitialized extent
before buffer write and convert the extent to initialized after IO completes.
This approach allows ext4 code to avoid using inode mutex, which improves
scalability on high speed storages. However this does not work with data
journaling and dioread_nolock option will be ignored with kernel warning.
Note that dioread_nolock code path is only used for extent-based files.
Because of the restrictions this options comprises it is off by default
(e.g.\& dioread_lock).
.TP
.B max_dir_size_kb=n
This limits the size of the directories so that any attempt to expand them
beyond the specified limit in kilobytes will cause an ENOSPC error. This is
useful in memory-constrained environments, where a very large directory can
cause severe performance problems or even provoke the Out Of Memory killer. (For
example, if there is only 512\ MB memory available, a 176\ MB directory may
seriously cramp the system's style.)
.TP
.B i_version
Enable 64-bit inode version support. This option is off by default.

.SH FILE ATTRIBUTES
The ext2, ext3, and ext4 filesystems support setting the following file
attributes on Linux systems using the
.BR chattr (1)
utility:
.sp
.BR a " - append only"
.sp
.BR A " - no atime updates"
.sp
.BR d " - no dump"
.sp
.BR D " - synchronous directory updates"
.sp
.BR i " - immutable"
.sp
.BR S " - synchronous updates"
.sp
.BR u " - undeletable"
.sp
In addition, the ext3 and ext4 filesystems support the following flag:
.sp
.BR j " - data journaling"
.sp
Finally, the ext4 filesystem also supports the following flag:
.sp
.BR e " - extents format"
.sp
For descriptions of these attribute flags, please refer to the
.BR chattr (1)
man page.
.SH KERNEL SUPPORT
This section lists the file system driver (e.g., ext2, ext3, ext4) and
upstream kernel version where a particular file system feature was
supported.  Note that in some cases the feature was present in earlier
kernel versions, but there were known, serious bugs.  In other cases the
feature may still be considered in an experimental state.  Finally, note
that some distributions may have backported features into older kernels;
in particular the kernel versions in certain "enterprise distributions"
can be extremely misleading.
.IP "\fBfiletype\fR" 2in
ext2, 2.2.0
.IP "\fBsparse_super\fR" 2in
ext2, 2.2.0
.IP "\fBlarge_file\fR" 2in
ext2, 2.2.0
.IP "\fBhas_journal\fR" 2in
ext3, 2.4.15
.IP "\fBext_attr\fR" 2in
ext2/ext3, 2.6.0
.IP "\fBdir_index\fR" 2in
ext3, 2.6.0
.IP "\fBresize_inode\fR" 2in
ext3, 2.6.10 (online resizing)
.IP "\fB64bit\fR" 2in
ext4, 2.6.28
.IP "\fBdir_nlink\fR" 2in
ext4, 2.6.28
.IP "\fBextent\fR" 2in
ext4, 2.6.28
.IP "\fBextra_isize\fR" 2in
ext4, 2.6.28
.IP "\fBflex_bg\fR" 2in
ext4, 2.6.28
.IP "\fBhuge_file\fR" 2in
ext4, 2.6.28
.IP "\fBmeta_bg\fR" 2in
ext4, 2.6.28
.IP "\fBuninit_bg\fR" 2in
ext4, 2.6.28
.IP "\fBmmp\fR" 2in
ext4, 3.0
.IP "\fBbigalloc\fR" 2in
ext4, 3.2
.IP "\fBquota\fR" 2in
ext4, 3.6
.IP "\fBinline_data\fR" 2in
ext4, 3.8
.IP "\fBsparse_super2\fR" 2in
ext4, 3.16
.IP "\fBmetdata_csum\fR" 2in
ext4, 3.18
.IP "\fBencrypt\fR" 2in
ext4, 4.1
.IP "\fBproject\fR" 2in
ext4, 4.5
.SH SEE ALSO
.BR mke2fs (8),
.BR mke2fs.conf (5),
.BR e2fsck (8),
.BR dumpe2fs (8),
.BR tune2fs (8),
.BR debugfs (8),
.BR mount (8),
.BR chattr (1)
