ext3

From Wikipedia, the free encyclopedia

Jump to: navigation, search
ext3
Developer Open Source Community
Full name Third extended file system
Introduced November 2001 (Linux 2.4.15)
Partition identifier 0x83 (MBR)
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 (GPT)
Structures
Directory contents Table, h-Tree with dir_index enabled
File allocation bitmap (free space), table (metadata)
Bad blocks Table
Limits
Max file size 16GiB – 2TiB
Max number of files Variable[1]
Max filename size 255 bytes
Max volume size 2TiB – 32TiB
Allowed characters in filenames All bytes except NUL and '/'
Features
Dates recorded modification (mtime), attribute modification (ctime), access (atime)
Date range December 14, 1901 - January 18, 2038
Date resolution 1s
Forks
Attributes No-atime, append-only, synchronous-write, no-dump, h-tree (directory), immutable, journal, secure-delete, top (directory), allow-undelete
File system permissions Unix permissions, ACLs and arbitrary security attributes (Linux 2.6 and later)
Transparent compression No
Transparent encryption No (provided at the block device level)
Supported operating systems Linux, BSD, Windows (through an IFS)

The ext3 or third extended filesystem is a journalled file system that is commonly used by the GNU/Linux operating system. It is the default file system for many popular Linux distributions. Stephen Tweedie first revealed that he was working on extending ext2 in a February 1999 kernel mailing list posting[2] and the filesystem was merged with the mainline kernel from 2.4.15 onward.[3]

Contents

[edit] Advantages

Although its performance (speed) is less attractive than competiting linux filesystems such as JFS2, ReiserFS and XFS, it does have the significant advantage that it allows in-place upgrades from the popular ext2 file system without having to back up and restore data as well as requiring lower CPU consumption[1] than ReiserFS and XFS.

The ext3 file system adds, over its predecessor:

  • A journal
  • Online file system growth

Without these, any ext3 file system is also a valid ext2 file system. This has allowed well-tested and mature file system maintenance utilities for maintaining and repairing ext2 file systems to also be used with ext3 without major changes. The ext2 and ext3 file systems share the same standard set of utilities, e2fsprogs, which includes a fsck tool. The close relationship also makes conversion between the two file systems (both forward to ext3 and backward to ext2) straightforward.

There are three levels of journaling available in the Linux implementation of ext3:

Journal 
(slow, but least risky) Both metadata and file contents are written to the journal before being committed to the main file system. This improves reliability at a performance penalty because all data has to be written twice. Without this setting in /etc/fstab, a file being edited in-place during a power outage or kernel panic risks being corrupted, depending on how the application is writing to the file.
Ordered 
(medium speed, medium risk) Ordered is as with writeback, but forces file contents to be written before its associated metadata is marked as committed in the journal. This is the default on many Linux distributions.
Writeback 
(fastest, most risky; equivalent to ext2 in some sense) Here metadata is journaled but file contents are not. This is faster, but introduces the hazard of out-of-order writes where, for example, files being appended to during a crash may gain a tail of garbage on the next mount or old files could appear after a crash. This is also how other metadata Journalling filesystems do (JFS,XFS and Reiserfs)

While in some contexts the lack of "modern" filesystem features such as dynamic inode allocation and tree-based data structures could be considered a disadvantage, in terms of recoverability this gives ext3 a significant advantage over file systems with those features. The file system metadata is all in fixed, well-known locations, and there is some redundancy inherent in the data structures that may allow ext2 and ext3 to be recoverable in the face of significant data corruption, where tree-based file systems may not be recoverable.

[edit] Disadvantages

[edit] Functionality

Since ext3 aims at being mostly compatible with ext2, many of the on-disk structures are similar to those of ext2. Because of that, ext3 lacks a number of features of more recent designs, such as dynamic allocation of i-nodes and variable block sizes (frags or tails).

ext3 filesystems cannot be fscked while the filesystem is mounted for writing. A dump of the filesystem taken while it is mounted read-write may result in corrupt data within the dump file.

ext3 does not support extents, a feature found in other filesystems such as JFS2, ext4 and XFS.

[edit] Defragmentation

There is no online ext3 defragmentation tool working on the filesystem level. An offline ext2 defragmenter, e2defrag, exists but requires that the ext3 filesystem be converted back to ext2 first. But depending on the feature bits turned on the filesystem, e2defrag may destroy data; it does not know how to treat many of the newer ext3 features.[4]

There are userspace defragmentation tools like Shake[2] and defrag[3], which work by copying each file and hoping the newly allocated file was not fragmented. However this only works if the filesystem is reasonably empty, and such filesystems are not usually fragmented. A true defragmentation tool does not exist for ext3 [4].

However, as the Linux System Administrator Guide[5] states, "Modern Linux filesystem(s) keep fragmentation at a minimum by keeping all blocks in a file close together, even if they can't be stored in consecutive sectors. Some filesystems, like ext3, effectively allocate the free block that is nearest to other blocks in a file. Therefore it is not necessary to worry about fragmentation in a Linux system."

[edit] Undeletion

Unlike ext2, ext3 zeroes out block pointers in the inodes of deleted files. It does this to simplify read-write access to the filesystem when the journal is being replayed after an unclean mount. This, however, effectively prevents files from being undeleted. The user's only recourse is to grep the hard drive for data known to signal the start and end of the file. This provides slightly more secure deletion than ext2, which can be either an advantage or a disadvantage.

[edit] Compression

Support for transparent compression (available as an unofficial patch for ext2) is not available in ext3.

[edit] Size limits

ext3 has a relatively small maximum size for both individual files and the entire filesystem. These limits are dependent on the block size of the filesystem; the following chart summarizes the limits[5]:

Block size Max file size Max filesystem size
1KiB 16GiB 2TiB
2KiB 256GiB 8TiB
4KiB 2TiB 16TiB
8KiB 2TiB 32TiB

It should be noted that the 8 KiB block size is only available on architectures which allow 8 KiB pages (such as Alpha).

[edit] No checksumming in journal

Ext3 does not do checksumming when writing to the journal. If barrier=1 is not enabled as a mount option (in /etc/fstab), and if the hardware is doing out-of-order write caching, one runs the risk of severe filesystem corruption during a crash.[6][7] (This option is not enabled by default on almost all popular Linux distributions, and thus most distributions are at risk.)

Consider the following scenario: If hard disk writes are done out-of-order (due to modern hard disks caching writes in order to amortize write speeds), it is likely that one will write a commit block of a transaction before the other relevant blocks are written. If a power failure or kernel panic should occur before the other blocks get written, the system will have to be rebooted. Upon reboot, the file system will replay the log as normal, and replay the "winners" (transactions with a commit block, including the invalid transaction above which happened to be tagged with a valid commit block). The unfinished disk write above will thus proceed, but using corrupt journal data. The file system will thus mistakenly overwrite normal data with corrupt data while replaying the journal. If checksums had been used (if the blocks of the "fake winner" transaction were tagged with mutual checksum), the file system could have known better and not replayed the corrupt data onto the disk. As of June 24, 2007, a patch is in the works to fix this problem.

[edit] Ext4dev / Ext4

Main article: ext4

An enhanced version of the filesystem was announced by Andrew Morton and released on October 10, 2006 under the name of ext4. It includes many new features.

[edit] Notes and references

  1. ^ The maximum number of inodes (and hence the maximum number of files and directories) is set when the file system is created. If V is the volume size in bytes, then the default number of inodes is given by V/213 (or the number of blocks, whichever is less), and the minimum by V/223. The default was deemed sufficient for most applications.
  2. ^ Stephen C. Tweedie (February 17 1999). Re: fsync on large files. Linux kernel mailing list.
  3. ^ Rob Radez (November 23 2001). 2.4.15-final. Linux kernel mailing list.
  4. ^ Andreas Dilger. Post to the ext3-users mailing list. ext3-users mailing list post.
  5. ^ Matthew Wilcox. Documentation/filesystems/ext2.txt. Linux kernel source documentation.
  6. ^ http://archives.free.net.ph/message/20070518.134838.52e26369.en.html
  7. ^ http://archives.free.net.ph/message/20070519.014256.ac3a2e07.en.html

[edit] See also

[edit] External links

cs:Ext3 de:Ext3 es:Ext3 eo:Ext3 eu:Ext3 fr:Ext3 gl:Ext3 it:Ext3 lt:EXT3 ms:Ext3 nl:Third Extended File System ja:Ext3 pl:Ext3 pt:Ext3 ru:Ext3 sk:Ext3 sl:Ext3 sv:Ext3 tr:Ext3 zh:Ext3

Views
Personal tools

Toolbox