From Gentoo Wiki
Jump to:navigation Jump to:search


ext2 (second extended filesystem) is an open source disk filesystem created for Linux, and the second version of the extended series of filesystems.

It is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer-generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when the system is booted and the filesystem happens to be in an inconsistent state.



Activate the following kernel options for ext2 support:

KERNEL Enabling ext2 support
File systems  --->
   <*> Second extended fs support

Support for optional ext2 features:

KERNEL Enabling ext2
File systems  --->
   [*]   Ext2 extended attributes
   [*]     Ext2 POSIX Access Control Lists
   [*]     Ext2 Security Labels
Optional ext2 support definitions
Option Description
Ext2 extended attributes Extended attributes are name:value pairs associated with inodes by the kernel or by users. See http://acl.bestbits.at/
Ext2 POSIX Access Control Lists Posix Access Control Lists (ACLs) support permissions for users and groups beyond the owner/group/world scheme. See http://acl.bestbits.at/
Ext2 Security Labels Enables an extended attribute handler for file security.

Large drive support

When the system has large disks (2 TB or greater) and a 32-bit (x86) kernel is being used, the following option (CONFIG_LBDAF) must be enabled:

KERNEL Enabling large drives for x86 kernels
-*- Enable the block layer  --->
    [*]   Support for large (2TB+) block devices and files

Use of ext4 filesystem driver

An alternative to the ext2 filesystem driver is using the ext4 filesystem code to access ext2 filesystems as well.

KERNEL Enabling ext4 for ext2 (CONFIG_EXT4_USE_FOR_EXT2)
File systems  --->
   < > Second extended fs support
   <*> The Extended 4 (ext4) filesystem
   [*]   Use ext4 for ext2 filesystems
   [*]   Ext4 POSIX Access Control Lists
   [*]   Ext4 Security Labels
The option "Use ext4 for ext2 filesystems" is not available when the ext2 filesystem driver "Second extended fs support" is enabled.

USE flags

The sys-fs/e2fsprogs package contains the utilities to work with the filesystem. In Gentoo Linux sys-fs/e2fsprogs is part of the system set and should be already installed on the system.

USE flags for sys-fs/e2fsprogs Standard EXT2/EXT3/EXT4 filesystem utilities

cron Install e2scrub_all cron script
fuse Build fuse2fs, a FUSE file system client for ext2/ext3/ext4 file systems
nls Add Native Language Support (using gettext - GNU locale utilities)
split-usr Enable behavior to support maintaining /bin, /lib*, /sbin and /usr/sbin separately from /usr/bin and /usr/lib*
static-libs Build static versions of dynamic libraries as well
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
tools Build extfs tools (mke2fs, e2fsck, tune2fs, etc.)


After setting the USE flag update the system so the changes take effect:

root #emerge --ask --changed-use --deep @world



The mkfs.ext2 command irreversibly destroys any content of the partition it is told to format. Be sure to select the right partition!

To create an ext2 filesystem on the /dev/sda1 partition:

root #mkfs.ext2 /dev/sda1

Please replace /dev/sda1 with the actual partition to format.

By default, 5% of available disk space is reserved for the root user. This is usually a good thing for the partition where the / directory is mounted, but it may be not desirable on other partitions. To lose reserve disk space for the root user use mkfs.ext2's -m 0 option:

root #mkfs.ext2 -m 0 /dev/sda1

See also

  • Ext3 — an open source disk filesystem created for Linux, and the third version of the extended series of filesystems.