Power loss -> no guarantee?
Posted Sep 17, 2009 11:11 UTC (Thu) by forthy
In reply to: Only with a UPS
Parent article: POSIX v. reality: A position on O_PONIES
This is wrong. Consider a log-structured, checksummed file system like
NILFS. It gathers all writes, writes them out in one go, and checksums
every chunk it writes. What happens when power is lost during that write?
The checksum is wrong. The last update before isn't touched, so the file
system will revert to this last update. All is hunky dory, all ponies
still there, no data lost except the last update - which is the guarantee
of such a file system: You can only depend that those data is on disk
where the transaction was completely written to disk. And note: writing
one sector to a hard disk takes a few microseconds nowadays, so the drive
can detect a power outage and stop writing before it randomly scrambles a
sector - it might not complete everything, but leaving a garbled sector is
possible to avoid.
On the other argument: In the part of the world where I live (Munich),
power outages are far less frequent than crashes. Our file server had some
CPU problems two years ago and crashed about once a week. Thanks to the
stability of ReiserFS, no data loss occurred during the half year until we
found the root cause and replaced the CPUs. Even when not including
hardware defects, I definitely have more crashes than power outages.
Frequent power outages happen in poor countries with third-world
to post comments)