Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
This is the approved revision of this page, as well as being the most recent.

Formatting a partition to ext4

Assuming the partition you want to format is called /dev/sdX, do:

mkfs -t ext4 /dev/sdX
# or
mkfs.ext4 /dev/sdX

The e2fsprogs package must be installed.

Setting mount options

You can set mount options for ext4 either by modifying /etc/fstab or tune2fs[1]

For example, to enable noatime on your filesystem, do:

tune2fs -o noatime /dev/sdX

Using an external journal

Ext4 allows you to use an external journaling device paired with a partition that actually stores your data.

To create a **new** partition with an external journal at /dev/sdb2, do:

mkfs.ext4 -F -O journal_dev -b 4096 /dev/sdb2
mkfs.ext4 -F -J device=/dev/sda1 -b 4096 /dev/sdb2

To convert a pre-existing filesystem, do:

mkfs.ext4 -O journal_dev /dev/sdb2
tune2fs -J device=/dev/sdb2 /dev/sda1

Feature flags

Ext4 has tons of feature flags that can be enabled using the tune2fs utility, a list of them can be found here.

To enable a feature flag, do:

tune2fs -O flag /dev/sdX

Some common feature flags used often are encrypt and fast_commit.

References