Journaled Filesystem Magic

I think I just saw the journaled filesystem in action. Like so much in life (or maybe not enough), it was one part freaky and one part amazing. Here's what happened.

First, some quick background info. My computer is kinda fucked. I know this, and I really need to get it repaired. It's under warranty; I'm just being lazy about it. But basically, the motherboard is hosed which has resulted in the failure of at least one firewire port and erratic behavior from certain USB ports. But worse is the fact that it's resulted in general instability on my system. This instability is at least farly predictable, and is well documented in my system logs, which frequently — particularly after wake from sleep — list I/O errors on the ATA bus. I.e. suddenly disk access is blocked to/from the hard drive. When this happens the only recourse is a hard reboot. And today, in true form, it happened.

Now for the weird part. Just prior to the crash, I had been processing some PNGs in Photoshop for my last article. I saved out the originals, saved out the modified PSD versions, then moved all these to a new folder called "Originals." Then I saved the modified PSDs back out to PNG for publishing on the blog. Shortly after doing all this, the crash happened. After I force rebooted, I logged into my account only to find that those last steps had been forgotten: The original PNGs were there, the PSDs were there, but the "Originals" folder and the new, modified PNGs were all gone. Freaky!

I can only assume that this was a result of journaling in action. My admittedly shallow understanding of how journaling works is that it keeps a running record of the state of the filesystem — particularly the last known good state of said filesystem — and when a crash occurs it reverts the filesystem to that last known state of working goodness. So it would seem that what happened in my case is that, even though I was still able to write to disk for a short while before my crash, the last known good instance of the filesystem existed before those last changes. So they were lost when the journal did its stuff.

Like I said: kinda cool; kinda freaky. Makes you feel a little delusional. You remember performing these actions, and yet somehow they've disappeared. On the other hand, I can only imagine the state my filesystem would be in at this point if it weren't for journaling. And this is the first time I've ever had data loss in two years of dealing with this issue. So journaling is definitely good and it really does work, if my experience is any indication, and if I've interpreted it correctly. If anyone out there has a better explanation of journaling, or of what might have really happened here, I'd love to hear it.

Either way, perhaps I should take this as an omen that it's time to head in to the shop.

dmesg had this to say:
HFS: Removed 12 orphaned unlinked files