Wednesday, January 25, 2012

The ext3 file system in Linux

The ext3 filesystem, developed byRedHat extends the popular ext2 filesystem with the introduction of journaling.

What is a Journaling Filesystem?

A journaling filesystem keeps a journal or log of the changes that are beingmade to the filesystem during disk writing that can be used to rapidlyreconstruct corruptions that may occur due to events such a system crash orpower outage. The level of journaling performed by the file system can beconfigured to provide a number of levels of logging depending on your needs andperformance requirements.

What are the Advantages of a Journaling Filesystem?

There are a number of advantages to using a journaling files system.

Both the size and volume of data stored on disk drives has grown exponentiallyover the years. The probelm with a non-journaled file system is that followinga crash the fsck (filesystem consistency check) utility has to be run. fsckwill scan the entire filesystem validating all entries and making sure thatblocks are allocated and referenced correctly. If it finds a corrupt entry itwill attempt to fix the problem. The issues here are two-fold. Firstly, thefsck utility will not always be able to repair damage and you will end upwith  data in the lost+found directory. This is data that was being usedby an application but the system no longer knows where they were referencefrom. The other problem is the issue of time. It can take a very long time tocomplete the fsck process on a large file system leading to unacceptable downtime.

A journaled file system records information in a log area on a disk (thejournal and log do not need to be on the same device) during each write. Thisis a essentially an "intent to commit" data to the filesystem. Theamount of information logged is configurable and ranges from not logginganything, to logging what is known as the "metadata" (i.e ownership,date stamp information etc), to logging the "metadata" and the datablocks that are to be written to the file. Once the log is updated the systemthen writes the actual data to the appropriate areas of the filesystem andmarks an entry in the log to say the data is committed.

After a crash the filesystem can very quickly be brought back on-line using thejournal log reducing what could take minutes using fsck to seconds with theadded advantage that there is considerably less chance of data loss orcorruption.

What is a Journal Checkpoint?
When a file is accessed on thefilesystem, the last snapshot of that file is read from the disk into memory.The journal log is then consulted to see if any uncommitted changes have beenmade to the file since the data was last written to the file (essentiallylooking for an "intention to commit" in the log entry as describedabove). At particular points the filesystem will update file data on the diskfrom the uncommited log entries and trim those entries from the log. Committingoperations from the log and synchronizing the log and its associated filesystemis called a checkpoint.
What are the disadvantages of aJournaled Filesystem?

Nothing in life is is free and ext3 and journaled filesystems are no exceptionto the rule. The biggest draw back of journaling is in the area of performancesimply because more disk writes are required to store information in the log.In practice, however, unless you are running system where disk performance isabsolutely critical the performance difference will be negligable.

What Journaling Options are Available with the ext3 filesystem?

The ext3 filesystem provides three options. These are as follows:
  • writeback - greater speed at the price of limited data integrity. Allows old data to show up in files after a crash and relies on kernel's standard writebacks to flush buffers.
  • ordered -  that the data is consistent with the file system; recently-written files will never show up with garbage contents after a crash at the cost of some speed.
  • journal - Journals all data requiring greater journal space and reduced performance. The most secure data retention policy.
Doesthe Journal log have to be on the same disk as the filesystem?

No, the ext3 journal log does not have to be on the same physical device as thefilesystem it is logging. On a RedHat Linux the journal device can be specifiedusing the journal_device= option with the -journal-options commandline argument of the tune2fs utility.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Procedure to clearing the ConfigMgr (SCCM) client local cache (CCM cache) -Resolving Disk space isssue

Essentially the client cache is a temporary download location for software, applications and software updates that are deployed to a clie...