Guides:Ext4
From atl.wiki
More actions
This is the approved revision of this page, as well as being the most recent.
This article or section lists commands or instructions which could potentially damage your system. Please ensure you understand the commands or instructions you are running or following before you run or follow them.
This warning exists to make users wary of running random commands or following instructions they see on the internet blindly and that they understand what they are doing to their system. Dangerous commands or instructions should be reported to an administrator immediately.
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
.