UFS Journaling during power loss

We have power losses here maybe more frequently than other locales. Anyway - I've noticed that, while I'm using the FreeBSD file system with journaling, very often the computer has to do a full fsck anyway.

So, if the journaling is there to protect in-flight data, and the journal is written first, it seems that a full fsck shouldn't be necessary after a power loss. Isn't such a situation (one such as a power loss) most of the motivation for using file system journaling?

Just wondering...
 
UFS is not self healing like ZFS although soft writes and the journalling do help somewhat. There is nothing in UFS that guarantees transactions to be atomic and that leaves lots of possibilities of metadata corruption even with journalling. To be honest the journalling was added to UFS to appease the criticism that it is slower compared to the main competitors to recover from power losses because you have to do a full fsck manually. Unfortunately the journalling doesn't add much to UFS under the typical server usage, if you get a power loss you should do a full fsck manually on all of your filesystems anyway.
 
kpa:

Thanks for the response. Well, I guess the journaling is not entirely useless, as some of the time it does indeed allow the full fsck to be avoided ...
 
I have switched journaling off on all UFS servers, simply because it hardly ever does what it needs to do. I almost always have to revert to a full fsck anyway.
 
As Michael W. Lucas would have it (in his book FreeBSD Mastery: Storage Essentials) , SU journaling can be somewhat helpful on most systems, but really shines the further up a storage pool scales. It doesn't obviate the need for or usefulness of fsck, but allows a system with a large storage pool (something like a half-dozen or more disks of 1Tb or more) to still boot, and do so exponentially faster after an unclean shutdown, so it can continue to run while maintenance is being performed. You shouldn't expect it to totally protect data, just the underlying filesystem, which still allows fsck or manual maintenance to put things back together.

Oddly, not only does there seem to be a lot of disagreement on SU+J that us relative noobs can't really sort out, but the opinions always range from indifference to hatred. Nobody seems to think SU journaling is great, some people hate it, and nobody seems to think soft updates alone are insufficient.
 
I would try to find ways to prevent the sudden power loss instead of relying on the healing properties of a filesystem. Sooner or later it's not going to be able to fix things and you will end up losing data.

Even a small UPS would be helpful, all it needs to do is signal the server and have enough power to allow for a clean shutdown.
 
SUJ means well, but it's a complicated solution. Some people see more problems and less stability, leading to the paradoxical situation of those who don't want to wait for a full fsck(8) actually seeing more of them with SUJ enabled.

Even a small UPS would be helpful, all it needs to do is signal the server and have enough power to allow for a clean shutdown.
Agreed. Healing filesystems are trying to correct a problem. Better to avoid that problem in the first place.
 
Journaling doesn't protect you from application behaviour either. A file can be in an inconsistent state between an open and a close. Clean shutdown means clean application closure too.

There are a few ports that talk to various vendor's UPS units and the better UPS vendors ship with their own software that's *nix friendly (typically a serial port is all that's needed). If you have a large UPS with many hosts connected, you can have one host monitor the UPS and signal the others.

I live in a temperate rain forest. This last month we had over 9in/22cm of rain and gusts of 34mpg/72kmph. Trees get top heavy, ground becomes soft and wind blows them over or just snaps off limbs. The power lines are strung between poles.
 
Back
Top