« The State of AppleScript | Main | Ease Of Use »

Journaling

created 24 Sept. 2002


Journaling in Mac OS X 10.2.2, what's up with that?



So, as everyone has seen since the release of Mac OS X (Server) 10.2.2, you can now enable journaling for HFS+ in Mac OS X Server. You can enable it in Mac OS X 10.2.2 non-server as well, via the diskutil command. However that version of the OS isn't optimized for journaling, so you may see a rather severe performance penalty for disk writes on straight Mac OS X 10.2.2, although my own tests haven't indicated a noticeable problem.


The first question here is what is journaling, and why do we care about it? When you have a journaled file system, any disk transaction that results in a change to the disk, (think anything that isn't a read here) is logged in a journal file, (hence the name.) This journal keeps track of the transaction, and the disk information on the transaction. If you work with databases, the journal is like the list of uncommitted transactions. Periodically, transactions are 'committed', or marked complete, and removed from the journal file. (This is necessary to avoid having truly obscenely large journal files.)


The journaling operation itself does impose a performance penalty on disk writes. Mac OS X Server alters the sizes of certain buffers used for file transactions when journaling is enabled, which mitigates much of the performance hit to take it from the 10-15% range, down to the 2-5% range, for a system with 512MB of RAM. The more RAM you have, the more buffering can be used, so your performance hit decreases accordingly. This buffering does not occur on Mac OS X, which is one reason why Apple is not supporting or recommending its use on non - Mac OS X Server systems. Also, it's not really needed for non-server systems, so if you don't need the protection, or can't take the speed hit, you may not want to use it on non - Mac OS X Server systems.


The 'magic' of journaling happens when your system crashes, or you have to reboot in anything other than a standard manner. Normally, in these cases, the disks are considered 'dirty' or in an unknown state, so the entire disk has to be checked via fsck on the reboot. This can take a few minutes on a 40 - 60GB disk, but if you have external or internal RAIDS in the multiple hundreds of gigabytes to the terabyte range, this checking can take hours, as the entire file system has to be checked, even though not all of it is in a potentially damaged state. If journaling is enabled, then the check gets more efficient. The journal file is 'replayed', and the information in the file is used to check only the parts of the file system that are truly in an uncertain state, and repaired based on the information in the file. So instead of checking an entire 600GB array for damage, only the 100 uncommitted writes are checked. It's the difference between having an error list as a guide and having to find the errors on your own. This allows the post-crash reboot times to be far faster.


(In tests on my 800MHz TiBook, the reboot times were decreased by half. On a single - CPU Xserve, the time reduction was much greater, due to the time saved on the 240GB RAID.)


So, if you have a need for increased data protection, then journaling may be a feature for you to consider. The next issue is; what changes happened to HFS+ to enable journaling? Well, from talking to Apple, not much. Talking to the Mac OS X Server folks at Apple, they told me that making journaling compatible with current setups was very important to them. So it's implemented in a fashion that is transparent to most applications. There are no changes to HFS+ that would require a reformat, or a conversion of any kind. Journaling can be enabled or disabled on the fly, via the Disk Utility application. The applications that would be affected the most by this are of course, disk repair utilities. My testing was limited to fsck and DiskWarrior, and showed no real issues. Apple has released a knowledge base article on using fsck with journaled volumes, that covers how to enable it as well. The only issue I have seen with DiskWarrior is that it invalidates the journal file, but that is most likely related to having to boot into Mac OS 9 to run DiskWarrior. No damage was caused, and re-enabling journaling took seconds, but it is a caveat. I don't use Drive 10 or Norton Utilities, so I didn't test with those.


The way journaling is being implemented in HFS+ indicates that you get a journaling addon to HFS+. It is not making HFS+ into a journaled file system, or JFS. There are more things to a ground-up JFS than a journal file, although you get most of the benefits with Apple's implementation. I have used, on Solaris systems, third party disk software that allows you to make a UFS disk into a journaled system, without having to reformat, and without changing the essential structure on the disk, and Apple's implementation reminds me of these.


Since I brought up the DiskWarrior caveat, there are a few more things to watch out for with journaling. First, Knowledge Base article 107252 points out that journaling and disk quotas are incompatible with each other, so if you need one, you can't use the other. Journaling in 10.2.2 is limited to HFS+ only, so if you use UFS, you are out of luck. If you use it on a portable drive, and move it in between 10.2.2 systems, then the journaling will follow the drive, so you keep the benefits for it there. (I've seen reports of people using it with iPods...okay, yes, you can do this, although I don't see the point in it.) But if you move a journaled drive to a system running an earlier version of Mac OS X, then the journal file is invalidated, and you have to re-enable journaling when you hook the drive back up to a Mac OS X 10.2.2 system. Mac OS 9 simply ignores the journal, but since you will have transactions that don't make it into the journal in that case, you should re-enable journaling after attaching a journaled drive to a Mac OS 9 system as well. With regard to the RAID software used on Xserves, journaling shouldn't affect rebuilding a mirror, but I haven't been able to test that, so caveat emptor in that case.


Now, should you use journaling. Well, my usual answer to that type of question is "If you're asking, the answer is most likely no." It's a very useful feature if you need that level of data reliability, but it has its penalties as well. Remember, just because you can do something, doesn't mean you should. If you have a test system, run it on that system, and get your own results. My lack of problems is only valid for my setup, not yours. Or yours. If you aren't running Mac OS X Server 10.2.2, then journaling puts you at odds with Apple Tech Support, so that's a consideration. As well, journaling does not mean you get to stop doing backups, or throw away your disk utilities. It helps data and disk integrity, it doesn't guarantee it. But from what I can see, it's a stable implementation that brings more good to the table than ill.

Categories:     Arcana, workingmac.com
Posted by John C. Welch at 21:56 | Permalink



Comments

Warning for Notes users: The commenting system uses HTML.
I know this will be scary for some of you, especially Notes fans. However, open standards, rah-rah.
If you want to use less-than or greater-than signs, or other similar charachters that HTML reserves,
you'll simply have to learn to do it the HTML way. Luckily, HTML is kind of popular, no matter what
your re-educators have told you, and you can easily find help on the intertubes.
digital.forest Where Internet solutions grow

There, a PayPal Button.

 
Family
The Artwork of Melissa Findley
Diane Francis @ the National Post Eric Francis @ the Calgary Sun

Apple Amazon Links
Mac OS X Server 10.6 Snow Leopard

Mac OS X 10.6 Snow Leopard

Mac OS X 10.6 Snow Leopard Family Pack (5-User)

Amazon Book Links
Legacy of Ashes: The History of the CIA

The Donnas: Bitchin'

Wizards at War (The Young Wizards, Book 8)

The Demon's Sermon on the Martial Arts

The Collected Stories of Arthur C. Clarke

JavaScript and Ajax for the Web, Sixth Edition

Awakening Warrior: Revolution in the Ethics of Warfare

FOB Links

Mac Web Writers

Techie Links

Review Victims