UFS Journaling during power loss

ronaldlees

Aspiring Daemon

Reaction score: 308
Messages: 732

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...
 

kpa

Beastie's Twin

Reaction score: 1,801
Messages: 6,318

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.
 
OP
OP
ronaldlees

ronaldlees

Aspiring Daemon

Reaction score: 308
Messages: 732

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 ...
 

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,780
Messages: 11,279

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.
 

ANOKNUSA

Aspiring Daemon

Reaction score: 372
Messages: 675

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.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,268
Messages: 29,700

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.
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,637
Messages: 13,850

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.
 

leebrown66

Well-Known Member

Reaction score: 129
Messages: 392

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.
 
Top