When is fsck dangerous?
Solution 1:
fsck
definitely causes more harm than good if the underlying hardware is somehow damaged; bad CPU, bad RAM, a dying hard drive, disk controller gone bad... in those cases more corruption is inevitable.
If in doubt, it's a good idea to just to take an image of the corrupted disk with dd_rescue
or some other tool, and then see if you can successfully fix that image. That way you still have the original setup available.
Solution 2:
You have seen one example where fsck
worked, but I've seen more then enough damaged file systems where it did not work successfully at all. If it would work fully automatic, you might have no chance to do things like a dd
disk dump or something like that which in many cases would be an excellent idea to do before attempting a repair.
It's never, ever a good idea to try something like that automatic at all.
Oh, and modern servers should have remote consoles or at least, independent rescue systems to recover from something like that without lugging a KVM rack to the server.