Ext4

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Ext4 and the translation is 25% complete.
Outdated translations are marked like this.


Resources

ext4 (viertes Extended File System) ist ein quelloffenes Dateisystem und die neueste Version der Extended-Reihe von Dateisystemen. Es ist das primäre Dateisystem, das von vielen Linux-Systemen verwendet wird, wodurch es wohl das stabilste und am besten getestete Dateisystem ist, das von Linux unterstützt wird.

Ursprünglich als Fork von ext3 entwickelt, bringt ext4 neue Funktionen, Leistungsverbesserungen und die Aufhebung von Größenbeschränkungen mit moderaten Änderungen am Festplattenformat. Es kann Volumes bis zu 1 EB und mit einer maximalen Dateigröße von 16 TB umfassen. Anstelle der klassischen ext2/3-Bitmap-Blockzuordnung verwendet ext4 Extents, die die Leistung großer Dateien verbessern und die Fragmentierung reduzieren. Ext4 bietet außerdem ausgefeiltere Blockzuweisungsalgorithmen (verzögerte Zuweisung und Multiblockzuweisung), die dem Dateisystemtreiber mehr Möglichkeiten zur Optimierung des Datenlayouts auf der Festplatte bieten.

Installation

Kernel

Aktivieren Sie die folgenden Kerneloptionen für die ext4-Unterstützung:

KERNEL Aktivieren der ext4-Unterstützung
File systems --->
 <*> The Extended 4 (ext4) filesystem Search for <code>CONFIG_CONFIG_EXT4_FS</code> to find this item.

Unterstützung für optionale ext4-Funktionen:

KERNEL Aktivieren optionaler Funktionen für ext4
File systems --->
 [*] Ext4 POSIX Access Control Lists Search for <code>CONFIG_CONFIG_EXT4_FS_POSIX_ACL</code> to find this item.
 [*] Ext4 Security Labels Search for <code>CONFIG_CONFIG_EXT4_FS_SECURITY</code> to find this item.
 [ ] EXT4 debugging support
Hinweis
Der ext4-Dateisystem-Code kann auch mit den Dateisystemen ext2, ext3 und ext4 umgehen. Die Kompatibilität bleibt dabei für existierende ext2- und ext3-Dateisysteme gewahrt, als ext4-Dateisystem eingehängt sind existierende Extended-Dateisysteme upgrade-fähig. Mit tune2fs können ext3- and ext4-spezifische Funktionen aktiviert werden, es verbleiben jedoch einige harte Limits vom Zeitpunkt der Erstellung eines Extended-Dateisystems.
Warnung
Die Zeitstempel von Dateien sind sowohl auf ext2- als auch ext3-Dateisystemen vom Jahr-2038-Problem („Y2k38"-Problem) betroffen, hingegen ist ext4 seit 2016, mit Linux-Kernel 4.3.6 and e2fsprogs 1.43, Y2k38-sicher.
Wichtig
Auf einem Standard-System mit ext4-Dateisystem ist es nicht nötig, ext3 oder ext2 in der Kernel-Konfiguration zu aktivieren. Die folgenden Abschnitte dazu sind hier allein aus historischen Beweggründen (Ext3) oder für sehr spezielle Anwendungsfälle (Ext2) angeführt.

Ext3

Der originale ext3-Dateisystem-Code wurde in Verion 4.3 des Linux-Kernels entfernt. Auch sollte es nur noch in den wenigsten Fällen notwendig sein, ein ext3-Dateisystem zu verwenden. Für einen solchen Fall steht der ext4-Treiber bereit, der für ext3-Dateisysteme volle Unterstützung bereitstellt.

Hinweis
It is advised to use the ext4 driver to mount ext3 filesystems. The old ext3 driver should not be enabled.

Die folgenden Kerneloptionen aktivierten die ext3-Unterstützung auf älteren Linux-Versionen:

KERNEL Aktivieren der ext3-Unterstützung
File systems --->
 <*> Ext3 journalling file system support

Aktivieren optionaler Funktionen für ext3:

KERNEL Aktivieren optionaler Funktionen für ext3
File systems --->
 [*] Default to 'data=ordered' in ext3 
 [*] Ext3 extended attributes
 [*] Ext3 POSIX Access Control Lists
 [*] Ext3 Security Labels

Ext2

Hinweis
Das ext2-Dateisystem unterstützt kein Journaling.
Warnung
Obwohl der Code des ext2-Dateisystems im Kernel verfügbar bleibt, wird nahegelegt, den ext4-Treiber zum Einhängen von ext2-Dateisystemen zu nutzen. Unter diesen normalen Umständen sollte der ext2-Treiber daher nicht aktiviert werden!
Hinweis
Der originale ext2-Dasteisystem-Treiber verblieb nur für sehr spezielle Anwendungsfälle im Kernel. Ein Beispiel: verglichen mit dem ext4-Dateisystem-Treiber benötigt der originale ext2-Code weniger Arbeitsspeicher.

Aktivieren Sie die folgenden Kerneloptionen für den historischen ext2-Dateisystem-Treiber:

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

Support for optional ext2 features:

KERNEL Enabling optional features for ext2
File systems --->
 [*] Ext2 extended attributes
 [*] Ext2 POSIX Access Control Lists
 [*] Ext2 Security Labels

Unterstützung für große Laufwerke

KERNEL Aktivieren großer Laufwerke für x86 Kernels
-*- Enable the block layer --->
 [*] Support for large (2TB+) block devices and files

USE-Flags

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

+tools Build extfs tools (mke2fs, e2fsck, tune2fs, etc.)
archive Add support for mke2fs to read a tarball as input. This allows not needing privileges. Needs app-arch/libarchive.
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)
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)
verify-sig Verify upstream signatures on distfiles
Data provided by the Gentoo Package Database · Last update: 2026年04月13日 11:36 More information about USE flags

Emerge

The sys-fs/e2fsprogs package and should be available as part of the default system set. Despite the historical name, the package includes utilities for ext3 and ext4.

root #emerge --ask sys-fs/e2fsprogs

Bedienung

Erstellung

Warnung
Der Befehl mkfs.ext4 zerstört unwiderruflich den Inhalt der Partition, die er formatieren soll. Achten Sie darauf, die richtige Partition auszuwählen!

Um ein ext4-Dateisystem auf der Partition /dev/sda1 zu erstellen:

root #mkfs.ext4 /dev/sda1

Mounting

See filesystem.

Ext4 without a journal

In specific use-cases it may be desirable to create a journal-less filesystem. Even though ext2 does provide exactly that, it is also affected by the year 2038 problem regarding file timestamps. Only the ext4 filesystem has been made Y2K38-safe.

In order to get the current Extended filesystem without a journal, an ext4 filesystem can be created without the has_journal feature, or modified accordingly. (Note that this is not possible on ext3 filesystems.)

Removing the journal from an existing ext4 volume

To display filesystem features currently enabled on a specific ext2/3/4 volume:

root #dumpe2fs -h /dev/sdx5 | grep "^Filesystem features:"

To disable the journal, the filesystem must be unmounted first:

root #umount /dev/sdx5
root #tune2fs -O ^has_journal /dev/sdx5

The leading ^ disables the specified feature. Otherwise the feature would be enabled; i.e. to enable a journal on an existing ext2 or journal-less ext4 filesystem:

root #tune2fs -O has_journal /dev/sdx5

Running dumpe2fs again, the has_journal feature should no longer be listed. The filesystem can now be mounted again:

root #mount /dev/sdx5
EXT4-fs (/dev/sdx5): mounted filesystem abcdef01-2345-6789-9876-543210fedcba r/w without journal. Quota mode: disabled.

Create a new journal-less ext4 volume

To create (i.e. format) a new ext4 volume without a journal, the default options of the ext4 filesystem type have to be overridden:

root #mke2fs -t ext4 -O ^has_journal /dev/sdx5

Utilities

Utilities included in sys-fs/e2fsprogs consist of:

Utility Description Man page
badblocks Scans a disk for bad blocks. badblocks(8)
debugfs An ext2/ext3/ext4 file system debugger. debugfs(8)
dumpe2fs A tool to dump ext2/ext3/ext4 filesystem information. dumpe2fs(8)
e2fsck A tool for checking ext2/ext3/ext4 filesystems. e2fsck(8)
e2image A tool for saving critical ext2/ext3/ext4 filesystem metadata to a file. e2image(8)
e2label A tool to change the label on an ext2/ext3/ext4 filesystem (symlinks to tune2fs).
e2undo A tool to replay an undo log for an ext2/ext3/ext4 filesystem. e2undo(8)
fsck.ext2 Checks, specifically, an ext2 filesystem (symlinks to e2fsck).
fsck.ext3 Checks, specifically, an ext3 filesystem (symlinks to e2fsck).
fsck.ext4 Checks, specifically, an ext4 filesystem (symlinks to e2fsck).
fsck.ext4dev Checks, specifically, an ext4dev filesystem (symlinks to e2fsck).
logsave A tool to save the output of a command in a logfile. logsave(8)
mke2fs The base program for creating ext2/ext3/ext4 filesystems. Creation commands symlink here. mke2fs(8)
mkfs.ext2 Creates, specifically, an ext2 filesystem (symlinks to mke2fs).
mkfs.ext3 Creates, specifically, an ext3 filesystem (symlinks to mke2fs).
mkfs.ext4 Creates, specifically, an ext4 filesystem (symlinks to mke2fs).
mkfs.ext4dev Creates, specifically, an ext24dev filesystem (symlinks to mke2fs).
resize2fs An ext2/ext3/ext4 filesystem resizer. resize2fs(8)
tune2fs Adjust tunable filesystem parameters on ext2/ext3/ext4 filesystems. tune2fs(8)
chattr Change file attributes on a Linux filesystem. chattr(1)
lsattr List ext2/ext3/ext4 file attributes. lsattr(1)
e2freefrag Report free space fragmentation information. e2freefrag(8)
e4defrag An online defragmenter for ext4 filesystem. e4defrag(8)
filefrag Report on file fragmentation. filefrag(8)
mklost+found Create a lost+found directory on a mounted ext2/ext3/ext4 file system. mklost+found(8)

Siehe auch

  • Ext4 encryption — provides instructions on encrypting files in a home partition using the ext4 filesystem's built-in file based encryption.
  • JFS — a 64-bit journaling filesystem created by IBM.
  • Btrfs — ein copy-on-write (CoW) Dateisystem für Linux, welches die Implementierung erweiterter Funktionen anstrebt und einen Fokus auf Fehlertoleranz, Selbsheilung und einfache Administration legt.
  • XFS — ein leistungsstarkes Journaling-Dateisystem
  • F2FS — a filesystem designed for NAND flash-based devices.

Externe Ressourcen

References