extended filesystem

from Wikipedia, the free encyclopedia

As extended file system , a number of are file systems referred to for Linux - operating system were developed. Since they are integrated in the source code of the Linux kernel , they are, like this one, under the GPLv2 . As open source software, the file systems have been ported to numerous other operating systems.

The extended file system was the first to be implemented on the virtual file system (VFS) integrated into the Linux kernel at the time . The first version was abbreviated as ext , all subsequent versions have the sequential number after them: ext2 , ext3 and ext4 . The abbreviation for file system at the end is also common, e.g. B. ext2fs or EXT4-fs .

To create and maintain the file systems, the e2fsprogs needed.

Versions

During the development, great attention was paid to expandable structures.

ext

The first version of the extended filesystem , or ext for short , was part of Linux starting with kernel version 0.96c from April 1992. It was developed as an extension to the Minix file system that had been used until then. Like this, ext is also based on inode tables, but extends the maximum length of file names from 14 to 255 characters and the maximum file size to 2  GiB .

The first extended file system was completely replaced by ext2 and removed from the Linux kernel with version 2.1.21.

ext2

As early as January 1993 there was the first alpha version of the second extended filesystem , ext2 for short , which expanded the existing extended file system with additional capabilities. The Unix File System (UFS) served as a model . B. was also used (and improved) by many BSD derivatives. The maximum size of the file system was increased to 2 TiB (which was increased again later) and the time stamps were extended to include Modification, Access, Change .

At the same time, at the beginning of 1993, there was another approach, Xia or xiafs (named after its developer Frank Xia), which was already more stable than ext2 , but not so easily expandable. The Xia file system was based directly on the Minix file system and was integrated into the kernel alongside ext2 . While both file systems initially offered the same capabilities, the active further development not only made ext2 more stable (and therefore on par with xiafs ), but also made it relatively easy to add new functions and capabilities thanks to the expandable design. In 2002, ext2 was the first Linux file system on which the POSIX ACLs were implemented.

Comparison of the file systems available in Linux 1993 and their limits
File system Max. Size ( 2 10 ) Max. Filename length
per file per volume
Minix 32 MiB 32 MiB 30 characters
ext 2 GiB 2 GiB 255 characters
Xia 32 MiB 2 GiB 248 characters
ext2 2 GiB 4 TiB 255 characters

The limits were later extended and are also related to restrictions in the kernel itself, because prior to Linux kernel 2.4, files larger than 2 GiB were not supported on any file system. The maximum file system size ( volume size) of ext2 also depends on the block size used - with 8 KB blocks, the file system may be max. 32 TiB big.

The second extended filesystem was the standard file system of Linux for a long time.

ext3

Journaling was introduced in 2001 with the third extended filesystem or ext3 . The driver for ext3 was removed with Kernel 4.3, since ext4 has all the necessary functions.

ext4

The fourth extended filesystem or ext4 has been in development since 2008 and is the current filesystem in the family. It was included as a modernization for ext2 / 3 in Linux kernel 2.6.19 and has been considered stable since version 2.6.28.

compatibility

Since kernel version 2.6.27, the file system driver for ext4 can also mount ext2 and ext3 file systems without changing the structures. The file system on the volume remains unchanged in the respective format so that it can still be used without restriction by older file system drivers for ext2 or ext3 .

Since the file systems are structured, an existing extended file system can always be upgraded . For example, to turn an ext2 into an ext3 file system, just add a journal:

tune2fs -j /dev/DEV

However, newer functions are only partially implemented. So z. For example, the size limit of the volume is always retained when it is created, even if the file system has been converted to a newer version with actually extended limits.

Conversely, by removing the journal from an ext3 - an ext2 file system can be made again if it was originally created as an ext2 file system or if the other activated functions and structures allow this:

tune2fs -O ^has_journal /dev/DEV

Of the tune2fs- parameter -O indicates which skill to add; a circumflex , ^means that the ability to be removed or deactivated.

To turn an existing extended file system into an ext4 file system, its basic functions must be activated:

tune2fs -O extent,uninit_bg,dir_index,has_journal /dev/DEV

By activating extents , newly created files always have this new capability so that they can no longer be converted back afterwards. Existing files, on the other hand, do not use extents , but this e2fsckcan be made up for with a run of .

As the file system is constantly evolving and new capabilities and functions are added, some of the newer file systems cannot be used by older drivers. The Linux kernel then outputs an error message with the flag of the incompatible function in brackets:

EXT4-fs (DEV): couldn't mount RDWR because of unsupported optional features (400)

In this example, the kernel message (which can be dmesgdisplayed with) means that the file system cannot be written to ( RDWRstands for read-write , i.e. read and write), because of the function with the identifier0x400. Check the documentation to find out that this is the feature introduced in 2012 metadata_csum. If you turn this off, you can use the file system on older kernel versions. However, this procedure does not work for all functions.

tune2fs -O ^metadata_csum /dev/DEV

At the same time, you can use it to activate newer functions on older file systems. This does not happen automatically for good reason, as this is the only way to maintain compatibility. So z. For example, an ext4 partition on an external hard drive that is mounted and written to on a very modern system will continue to work with the older system on which it was originally formatted. The program dumpe2fsprovides information about which functions are currently activated on a volume with an extended file system:

dumpe2fs -h /dev/DEV

Year 2038 problem

All versions up to and including ext4 have in common that they are fundamentally affected by the year 2038 problem or, in the case of ext4 , were affected, since the storage of the time stamps in 2007 was expanded from 32 to 34 bits with Kernel 2.6.23. However, there was an error when converting the original 32-bit Unix time to 64-bit (because 34 bits are processed as 64-bit values), which occurred between 2014 and 2016 and finally with Linux kernel 4.3.6 dated February 19, 2016 was corrected.

The prerequisite is an inode size of at least 256 bits (the original standard for ext2 was 128 bits) and adaptede2fsprogsthat support version 1.40 and higher extra_isize. With version 1.43.x (2016) and newer,e2fsck also correct the erroneous 34-bit timestamps.

If an ext2 or ext3 file system is extended by the extra inode, with or without the time stamp, which has been increased by 2 bits, it can only be attached as an ext4 file system from now on :

#mount -t ext2 /dev/sda1 /boot
#mount | grep "sda1"
/dev/sda1 on /boot type ext2 (rw,errors=remount-ro,user_xattr,acl)
#dmesg -t | tail -n1
ext2 filesystem being mounted at /boot supports timestamps until 2038 (0x7fffffff)
#umount /dev/sda1
#dumpe2fs -h /dev/sda1 | grep "features"
dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
#tune2fs -O extra_isize /dev/sda1
#dumpe2fs -h /dev/sda1 | grep "features"
dumpe2fs 1.45.5 (07-Jan-2020)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file extra_isize
#mount -t ext2 /dev/sda1 /boot
mount: /boot: Falscher Dateisystemtyp, ungültige Optionen, der Superblock von /dev/sda1 ist beschädigt, fehlende Kodierungsseite oder ein anderer Fehler.
#dmesg -t | tail -n1
EXT2-fs (sda1): error: couldn't mount RDWR because of unsupported optional features (40)
#mount -t ext4 /dev/sda1 /boot
#dmesg -t | tail -n1
EXT4-fs (sda1): mounted filesystem without journal. Opts: errors=remount-ro

Individual evidence

  1. ^ A b c Rémy Card, Theodore Ts'o, Stephen Tweedie: Design and Implementation of the Second Extended Filesystem. Retrieved May 14, 2020 (English).
  2. https://www.freebsd.org/doc/handbook/filesystems-linux.html
  3. EXT4-fs error: bad header / extent
  4. https://linux.die.net/man/5/filesystems
  5. a b c Udo Seidel: The ext filesystem - a four-generation retrospective. In: Edition 156/2013. Linux Magaxine, accessed on May 17, 2020 .
  6. Ext2. In: Glossary. DiskInternals, accessed on May 14, 2020 (English): "Features such as POSIX ACLs and extended attributes were generally implemented first on ext2 because it was relatively simple to extend and its internals were well-understood."
  7. ^ Andreas Jaeger: Large File Support in Linux. February 15, 2005, accessed May 17, 2020 .
  8. ^ The Second Extended Filesystem. In: The Linux Kernel documentation. Retrieved May 17, 2020 (English).
  9. Thorsten Leemhuis: Kernel log: Ext4 filesystem leaves the development phase - a stopover on the way to btrfs. In: Heise online . October 15, 2008 . Retrieved May 15, 2020.
  10. a b https://ext4.wiki.kernel.org/index.php/UpgradeToExt4
  11. https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#The_Super_Block
  12. ext4: Add nanosecond timestamps. July 18, 2007, accessed June 4, 2020 .
  13. INODE (7) - inode - file inode information. ( Manpage ) In: Linux Programmer's Manual. May 9, 2019, accessed on June 4, 2020 (English): “Nanosecond timestamps are supported on XFS, JFS, Btrfs, and ext4 (since Linux 2.6.23). Nanosecond timestamps are not supported in ext2, ext3, and Reiserfs. "
  14. Bug 23732 - ext4 timestamp range contains 68-year gaps. ( Bug report ) In: Kernel.org Bugzilla . March 20, 2016, accessed June 4, 2020 .
  15. Theodore Ts'o: Re: [PATCH] fs: ext4: Sign-extend tv_sec after ORing in epoch bits. ( Mailing list ) In: LKML. March 31, 2014, accessed June 4, 2020 .
  16. Linux 4.3.6. ( Changelog ) In: Kernel.org. February 19, 2016, accessed on June 4, 2020 (English): "ext4: Fix handling of extended tv_sec"
  17. E2fsprogs Release Notes. Retrieved on June 4, 2020 (English): "Add on-disk format definitions for the following new features:… EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE"