What exactly is disk journalling?

michaelsanford

Translator, Web Developer
I've seen it in cocktail, I've seen it on the Panther specs page, but I still don't know what it is.

What is disk journalling, and why should I be concerned with it on an effectively single-user system?
 
Basically journaling keeps a log of all the read/write action to your hard drive, and is useful when your machine crashes because you can quickly see if any data was corrupted (the hard drive would have been interrupted during the crash) so it can be fixed quickly and you can save a trip to single user mode and fsck. Somewhere on the board I have a post with a few helpful links, and try Google, I'm sure there's something good there.
 
Is it resource-intensive? It sounds like it probably is heavily (essentially doubling all disk writes)? Is it enabled (in 10.2.8) by default?

Thanks mr K
 
I don't know about the resource intensive part - it probably isn't too great a burden depending on disk speed. But in 10.2.8 it is not enabled by default and in panther it is an option to select when installing (I don't know about upgrading...)
You have to select HFS+ with Journaling or something like that.
 
I looked at the info on Apple's support page searching on "journal log". It tells how to enable/disable, plus some useful stuff.

Also, although the info alludes to jounaling a disk, thinking of it as journaling all the filesystems on a certain disk. Filesystems have 2 tipes of information:

(1) Data - your applications stuff

(2) Metadata - time, ownership, permissions, pointers to all disk block containing the data.

During filesystem writes, jounaling places the Metadata in a log file until the data is written to disk.

On my imac running 10.2, #df-k shows my whole disk as 1 filesystem taking-up the entire disk.

As to whether or not to journal:

The whole disk is 1 filesystem. A power disruption while writing to disk could corrupt your filesystem. You cannot mount a corrupted filesystem.

You then run #fsck to repair the filesystem. With jounaling, the journal log gets replayed 7 almost always fixes the problem(s).
Without journaling #fsck must read the disk, and sometimes fixes the problem.
So, from a reliability standpoint we have "almost always" versus "sometimes".

Hey, don't worry, if your filesystem won't #fsck clean, there is a workaround:

use #mkfs/#newfs to rebuild the filesystem, then do a full restore from backup. Couldn't get worse, right?
Remember, on my system, the whole disk is 1 big filesystem.
How can I run #mkfs/#newfs you say? Ah, from your O/S CD!!

As to the performance hit, if Apple's jfs is like Veritas & AIX, only writes get journaled. As a single user host, you will probably not be write-intensive unless you create big streaming files. It isn't so much the performance hit of an additional write, but the real hit is when the journal log fills & the system is waiting for some journal log space to do more writes.
 
Back
Top