Ext3 File System

Introduction

Experienced users of Linux know that the system has excellent performance in data management, both in regard to the storage, and in the allocations and updates of information. Among several, one of the major responsible for such efficiency is the file system (or filesystem) ext3 (acronym for third extended file system), which is now being integrated definitely Linux (kernel from of version 2.4. This article will show you the features the most important of ext3, in addition to the reasons of their high performance.

File system?

It’s important to understand what is a file system before proceeding in the matter. In a few words, a file system it is a structure that indicates how the data should be recorded in recording devices. It is according to the resources offered by this structure that it is possible to determine the space available and occupied on disk, and manage how parts of a file can be “distributed” in the area’s storage. It is also the file system that determines as the data can be accessed, copied, moved, renamed, protected and deleted. Therefore, without a file system, it is impossible to use a hard drive (and other devices) for storage information.

The standard operating of file systems in Linux

The file systems are created on the partitions of the disk, so that it is possible to store programs and data in the form of files and directories (folders). The Linux, as well as virtually all Unix-based operating systems, uses a system files that have a hierarchy, composed of files and directories, that can contain other directories or files.

The files/directories (Unix-based systems treat directories how to specific files) in a file system for Linux are provided (or mounted) to manipulation via the command “mount”, usually triggered in the process startup (startup), which occurs when the computer is turned on and begins to load the operating system. Linux can work with many file systems in one and the same disk (a situation common to the users that have Windows and Linux on their machines, for example), and to “see them”, stores the list of file systems available in the archive /etc/fstab (note that /etc/ indicates a directory path). In however, there is a list of file systems that are effectively in use, available in the file /etc/mtab, also known as the “table mount”. This list is updated in the process of startup to indicate to the operating system which systems of files it can access.

For each mounted file system on the startup, a bit in the header the file system is reset to indicate that the file system is in use from that time and that the data structures used for the allocation and organization of files/directories can be changes (updates).

When the user decides to turn off the computer and use commands to shut down Linux, the file systems are dismounted, making with the bit quoted above is modified to indicate that the system of files is consistent, ie, can no longer suffer changes.

Errors and corruption in the system files

The file systems for Linux already suffered many kinds of treatments and rewrote code to eliminate the corruption caused by the applications or by the kernel itself. In however, to eliminate the corruption of data in files that are caused, for example, by power outage or by an improper shutdown of the user, has always been a task practically impossible. When the system is shut down incorrectly the bit of the header of the system file is not set. The solution was to do with that, in the next process of loading Linux, it is checked if the header is the bit of the header set to indicate that the file system is consistent and not handled. If not, the tool used “fsck” checks the system in search of errors.

Journaling

The fsck can provide satisfactory results, but the fix errors can take a long time, something unacceptable in applications critical. In addition, if the incorrect shutdown of the computer occurred when data was being written to the disk, the fsck not you’ll be able to complete these processes, leading to loss of information that they were being recorded.

Faced with these problems, was presented a viable solution: the use of file systems with the technology, “Journaling”, that have the ability to keep track of the changes that will be made to the file system (for example, writes/updates data) before they are actually made. These information the Journaling captures are then stored in a part separate file system, called the “Journal” (but also known as “log records”). When the information are stored in the Journal, the file system applies the changes recorded it, and then, removes the information from the Journal.

Now, to understand the why of Journaling to be a solution efficient for the problems of error. The log records are written before that the changes actually occurring in the system files and these records are only deleted when the changes are made. Thus, if the computer is improperly shut down, the assembly process on the next startup it will check if there are changes recorded in the Journal “marked” as not made. If there are such changes then applied to the file system. This causes the risk of loss data are reduced dramatically.

Ext3 file system

There are several file systems available with the technology Journaling, such as XFS, originally developed by Silicon Graphics and later released with open code, ReiserFS, developed especially for Linux, JFS, originally developed by IBM but also released with open source, and more known of them: the ext3 file system, developed by Dr. Stephen Tweedie together with other collaborators, in Red Hat, and that we will now see.

The ext3 file system is basically the system files ext2 with resources for Journaling. Perhaps, this may be the reason of your wide use: it is fully compatible with ext2 (which was a file system that is very used), which no other system files based on Journaling is.

The ext3 file system started to be effectively supported by the Linux kernel from of version 2.4. Consequently, all of the distributions Linux released with this kernel or higher, you must support the default for ext3.

In ext3, the code of Journaling uses a layer called “Journaling Block Device (JBD). The JBD was created with the purpose of implementing Journal in any kind of device based on blocks of data. By example, the code ext3 informs and “asks permission” to the JDB to make the changes, before you modify/addany data on the disk. Thus, it is the JDB that truly “manages” the Journal. The most interesting fact of this is that, the JDB works as an independent entity, allowing not only the ext3 le system to use, but also other file systems.

The JDB uses a different method from other Journalings to recovery information. Instead of storing the information in bytes that should be implemented, the JDB writes the own blocks modified system files. Thus, the ext3 file system also stores “replicas” complete blocks modified in memory to track the operations that were pending. The disadvantage of this way of working is that the Journalends up being larger. However, ext3 does not need to deal with the complexity of the Journalings that work writing bytes.

Types of Journaling in ext3

Ext3 supports three different working modes of Journaling. They are:

Journal: records all changes in file system. It is the slowest of the three modes, but is the one that has greater capacity to avoid data loss;

Ordered: writes only the changes in files metadata (files that hold information about other files), but it saves the updates to the data file before make the associated changes to the file system. This Journaling is the default in file systems ext3;

Writeback: also it only records changes to the file system metadata, but uses the writing process the file system in use for recording. Is the the fastest ext3 Journaling, but the least reliable.

The mode Ordered is the default in ext3, but it is possible specify which mode you want to use, through the update the fstab file. For example, it may be that the line /dev/hda1,/opt have their option date with value ordered. You can change this value to write back or journal.

Ending

Ext3 is one of the systems most used files on Linux, having as its main “adversary” to the filesystem ReiserFS, that also has the features of Journaling as one of its main features. Say which one is best is a task complicated, reason by which there are several tests on the Internet that try to answer this question. In any case, the teams of both file systems strive to offer the best possible resources to its users. In the case of ext3, for example, is already in development the ext4 (that was available as “experimental” on the date of the update of this article), which shall come on to the scene offering improvements in its structure and support for large files (with hundreds of megabytes), for example.

Ext3 File System 1