Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What is a Journaling file system?

Even wikipedia doesn't give much information. Apart from NTFS which other file systems(on Windows / Linux) support journaling and how does it give a performance boost?

share|improve this question

4 Answers 4

up vote 11 down vote accepted

A journaling filesystem records changes to the filesystem before it actually performs them. In this way it is able to recover after a failure (e.g. power fail) with minimal loss of data.

The Features section of Wikipedia's comparison of filesystems gives which are journaled.

Journaling does not give a performance boost. In fact, the journaling operationn reduces the speed slightly, in exchange for the above reliability.

share|improve this answer
2  
While journaling does slow down normal IO operations it does speed up recovering from an unsafe shutdown or unmount. Having to run a disk check on a multi-terabyte volume with a file system that doesn't have journaling will take days. Where a journaling file system can do it in seconds or minutes. Also most journaling file systems on Linux allow you to specify a different device for the journal to avoid the performance hit. Unfortunately this question is about NTFS which doesn't support that. –  3dinfluence Aug 22 '10 at 4:16

In essence, what a journaling file system does is add an extra level of abstraction between the hard drive and the operating system. Rather than perform operations directly on the disk, it keeps track of what it's trying to do first, then whether or not it succeeds.

For example, if you wanted to move a file from one drive to another, the procedure would look something like the following:

  • Physically copy old file to new location
  • Update directory entry on new drive
  • Remove directory entry from old drive
  • Free space on old drive

Exact process is filesystem dependent, but you get the idea. This would normally work fine, but in the off chance of a system crash, things could be interrupted halfway through. You may end up with the file physically copied, but no directory entry pointing to it. You may end up with the directory reference removed on the old drive, but the space not freed. In some cases, you may end up with a corrupted filesystem which won't even work anymore because a directory entry is only partially written.

In other words, a lot can go wrong.

A journalled file system would use the same basic procedure, with a few additional steps. Something like:

  • Journal entry: Moving file from A to B
    • Physically copy old file to new location
    • Update directory entry on new drive
    • Remove directory entry from old drive
    • Free space on old drive
  • Journal entry: Done moving file from A to B

If this process gets interrupted for any reason, such as a system crash, the filesystem now knows what was in progress, and whether it completed or not. It can then recover quickly and gracefully, either by trying to complete the transaction from the beginning, or by putting the filesystem back to the state it was in before. All this without needing to resort to a block-by-block check of the filesystem to find errors, which can be painfully time-consuming given the size of modern hard drives.

This can significantly improve the robustness of the filesystem, and speed up recovery time in the case of failure. Different levels of reliability can be gained by changing the granularity of the journal entries -- this again is filesystem dependent.

Since journalling inevitably involves more steps than the alternative, there would not be any performance boost unless you feel like crashing a lot. However, the difference in performance is often negligible compared to the advantages.

share|improve this answer
    
Also, there are different forms of journal: metadata only, data + metadata, ordered (in case of ext3/4 fs). The rule of thumb is "the more secure, the bigger performance hit". Not that the performance hit is completely acceptable given the advantages of having a journal when you have TB or even PB of data :) –  coredump Aug 22 '10 at 4:49

The wikipedia article on Journaling file system contains a lot more details on what it is, how it works, and why.

share|improve this answer

A journaling filesystem is a term being misused widely for filesystems that are not, after all, journaling.

What "journaling" means in the context of filesystems is that the filesystem is capable of recovering from crashes and power losses to a consistent state. It does not mean a performance boost, it doesn't mean that the filesystem recovers to a complete snapshot some time before the crash, it doesn't even mean that there wouldn't be a "filesystem check" style operation to recover after a crash.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.