ext4

from Wikipedia, the free encyclopedia
ext4
Manufacturer Mingming Cao, Dave Kleikamp, ​​Alex Tomas, Theodore Ts'o , others
Full name Fourth extended filesystem
Initial release October 14, 2008 (test version since Linux 2.6.19, final since Linux 2.6.28)
Partition identifier 0x83 ( MBR )
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 ( GPT )
Technical implementation
Directories Table, H-tree
Files bitmap (free space), table (metadata)
Defect block list Table
Maximum values
Size of a file File system size
Number of subdirectories per directory 64000
Length of the file name 255 bytes
File system size 1 EiB = 1024 PiB (> 16 TiB from e2fsprogs version 1.42)
Allowed characters in the file name All bytes except NULL and '/'
properties
Dates of a file modification (mtime), attribute modification (ctime), access (atime), create (crtime)
Date range 12/14/1901 to 04/25/2514
Forks No
File attributes extent, data = journal, data = ordered, data = writeback, commit = nrsec,
orlov, oldalloc, user_xattr, nouser_xattr, acl, noacl, bsddf, minixdf, bh, nobh
File rights management POSIX
Transparent compression No
Transparent encryption Yes
Supporting operating systems Linux

The ext4 ( English fourth extended filesystem ) is the fourth extended filesystem , which was developed for the Linux kernel. It is the successor to ext3 and like that a journaling file system . In contrast to ext3, journaling can also be switched off.

history

ext4 was introduced on October 10, 2006 by Andrew Morton . From version 2.6.19 a preliminary test version was an official part of the Linux kernel. With the release of Linux 2.6.28 on December 24th, 2008 ext4 left the main development stage and is considered stable. In Linux 4.3 the native driver code for ext3 has been permanently removed. The ext4 driver will continue to support ext3 in the future.

Technical characteristics

ext4 uses 48- bit block numbers (ext3 was 32-bit) and supports partitions or volumes up to 1  EiB in size ( volumes larger than 16  TiB only from e2fsprogs version 1.42 of November 29, 2011), in contrast to ext3 , the only allows 32  TiB (depending on the size of a memory page in the respective machine architecture , with IA-32, for example, only a maximum of 2 32 · 4  KiB = 16 TiB are possible). Files can also be addressed via extents , with storage units being combined to form a coherent block. This leads to a reduction in the additional work ( RAM , I / O accesses and transactions ) for large files, because only the number of the first block and its number have to be saved (and not each block individually) and can increase operational performance.

The following improvements have been implemented since the release in kernel 2.6.19:

  • Kernel 2.6.23: more than 32,000 sub-directories (Directories dir_nlink, files: large_dir)
  • from Kernel 2.6.25: maximum file size as large as the entire file system ( huge_file)
  • from Kernel 2.6.28: ext4 is considered stable
  • From Kernel 2.6.33: TRIM support (including parameters discardwhen mounting )
  • from Kernel 3.0: multiple mount protection ( mmp)
  • from Kernel 3.2: clustered block allocation ( bigalloc)
  • from Kernel 3.6: quota inodes in superblock ( quota)
  • from Kernel 3.8: data stored in inode and extended attribute area ( inline_data)
  • from Kernel 3.16: more extreme version of sparse_super ( sparse_super2)
  • from Kernel 3.18: metadata checksumming ( metadata_csum)
  • from Kernel 4.1: support for file-system level encryption ( encrypt)
  • from Kernel 4.4: store the metadata checksum seed in the superblock ( metadata_csum_seed)
  • from Kernel 4.5: project quota ( project)
  • from Kernel 4.13: increased limit of size and number of extended attributes per file ( ea_inode)
  • from Kernel 4.13: increased limit of number of files per directory ( large_dir)
  • from Kernel 5.2: Case sensitivity can now be switched off optionally ( casefold)
  • from Kernel 5.4: support of verity protected files ( verity)

Each of these improvements in a new ext4 version in the Linux kernel means that volumes formatted with them , e.g. B. on (removable) data media, on another system with an older version of the kernel cannot be read unless the newly added functions on the data carrier are switched off beforehand, for which auxiliary programs are available. Most distributions use presets when formatting, which automatically enable certain newer features.

Further improvements compared to ext3 / ext2 :

Extents
The most important innovation in ext4. Other file systems such as B. JFS or XFS have offered this function for a long time. It brings speed advantages when managing large files and prevents fragmentation.
Function- specific mount options: extent. This option is not listed in the man page because it is used by default if a corresponding ext4 partition has been set up with it or an existing ext3 partition has been converted to an ext4 partition with the tune2fsoption -O extent.
Improved timestamps
ext4 offers time stamps on a nanosecond basis. Furthermore support for file-generated date stamps.
Online defragmentation
Defragmentation while the partition is mounted. Function not yet completed.
Journal with checksum support
This function is backwards compatible with older kernel versions and is ignored by them.
Function-specific mount options: journal_checksum
Multiple pre-allocation of file blocks and inodes
Results in more efficient writes.
Function-specific mount options: nomballoc, mballoc (both not listed in man pages), oldalloc, orlov (default)
Time-delayed allocation of file blocks and inodes.
Currently only in "data = writeback" journaling mode, later versions should also support the "data = ordered" mode. Results in less CPU load and less fragmentation.
Function-specific mount options: nodelalloc, delalloc
TRIM support
As of Kernel 2.6.33, the mount option discard / nodiscard can be used to specify whether ext4 reports the free space of memory areas to the mounted device using a TRIM command; this is supported by SSDs and the device mapper (with "thin provisioning").

With existing ext3 partitions, some of the ext4 features can be activated without reformatting . ext2 and ext3 partitions can be mounted as if they were ext4 partitions. This already results in small performance gains through optimization in the ext4 driver.

Transparent encryption

Since kernel 4.1 ext4 supports encryption. This was initially developed by Google and built into ext4 directly; Since Kernel 4.6, the encryption under the name fscrypt has been a separate library in the Linux kernel, which can be used via hooks in file systems. Besides ext4, F2FS and UBIFS have implemented support for fscrypt. The key handling is managed via the kernel keyring.

With e4crypt there is a reference implementation for a userspace tool for creating keys and activating the encryption for directories. An alternative implementation are the tools fscryptctl and fscrypt.

Requirements:

  • The blocksize of the ext4 file system must match the pagesize of the system
  • Kernel from 4.1 required.

Properties:

  • Transparent encryption. I.e. no extra software layer is added to the file system such as B. at ecryptfs. Individual folders or the entire file system can be encrypted.
  • Key handling via keyring of the kernel.
  • Encryption takes place folder by folder: An empty directory is created and a policy (a key) is then assigned to it. Then you can copy files into this directory and create folders, which are all encrypted in a row.
  • An encrypted directory can only contain encrypted files.
  • Encryption can be activated when creating the ext4 file system or afterwards.
  • Salt and passphrase hash are stored in the superblock of the ext4 file system. The key is formed from this.
  • Several keys can be used for different directories.

Disadvantage:

  • File attributes such as date and size remain unencrypted. Only the content of the file and its name are encrypted.
  • The directory '/' must not be encrypted; if you try to do this, an error message is generated from Kernel 4.13.
  • Unencrypted files cannot be encrypted afterwards; they have to be copied into an encrypted folder.

disadvantage

Delayed allocation of file blocks and inodes increases the risk of data loss in the event of a crash or power failure. In Kernel version 2.6.30 this problem has been alleviated compared to earlier versions.

See also

Web links

Individual evidence

  1. Kernel.org - Ext4 Howto
  2. Linux file system ext4 in the kernel 2.6.19 on heise.de , October 12, 2006
  3. Linux kernel 2.6.28 published on heise open, December 25, 2008
  4. Jörg Thoma: The Ext3 driver is missing in Linux 4.3. In: Golem.de . September 15, 2015, accessed September 15, 2015 .
  5. Linus Torvalds : Re: [GIT PULL] Ext3 removal, quota & udf fixes. (No longer available online.) In: Gmane .linux.kernel. September 2, 2015, formerly in the original ; accessed on September 15, 2015 .  ( Page no longer available , search in web archivesInfo: The link was automatically marked as defective. Please check the link according to the instructions and then remove this notice.@1@ 2Template: Dead Link / article.gmane.org  
  6. EXT4 (5) File Formats Manual. April 30, 2020, accessed on May 1, 2020 .
  7. Thorsten Leemhuis: Kernel Log: Linux 5.2. In: Heise online . June 28, 2019 . P. 2: Ext4 file system can now ignore upper and lower case. Retrieved June 30, 2019 .; Quote: "Developers have developed this" Casefold Feature "feature in order to use it with Android - so far the mobile operating system has used a rather inelegant hack in the form of an intermediate layer called" Wrapfs "to achieve case insensitivity with Ext4."
  8. Reading of a data carrier not possible due to new functions of Ext4. In: Stack Exchange . April 14, 2017, accessed April 28, 2020 .
  9. tune2fs (8) - Linux man page. April 30, 2020, accessed on May 1, 2020 .
  10. mke2fs.conf (5) - Linux man page. April 30, 2020, accessed on May 1, 2020 .
  11. Ext4 Wiki: Extents
  12. The Linux file system Ext4
  13. Linux Kernel Newbies - ext4
  14. Kerneldoc for ext4  ( page no longer available , search in web archives )@1@ 2Template: dead link / git.kernel.org
  15. Linux Kernel Newbies - ext4
  16. Ext4 Wiki: Ext4 Howto - Online defragmentation
  17. a b man-page for mount - ext4 mount options
  18. Proceedings of the Linux Symposium 2008 PDF Chapter 2.3, 2.4
  19. Proceedings of the Linux Symposium 2008 PDF Chapter 1
  20. Proceedings of the Linux Symposium 2008 PDF Chapter 3, 4
  21. Ext4 in the kernel documentation
  22. Thorsten Leemhuis: Three file systems on heise open, November 30, 2006
  23. Linux Kernel Newbies Migrate existing Ext3 filesystems to Ext4
  24. EXT4 Encryption Harder, Better, Faster, Stronger. Google, accessed June 19, 2018 .
  25. a b Filesystem-level encryption (fscrypt) - The Linux Kernel documentation. Accessed June 19, 2018 .
  26. google / fscryptctl. Accessed June 19, 2018 .
  27. google / fscrypt. Accessed June 19, 2018 .