Suppose you are doing a full speed
write to disk in a linux pc box with ssd or mechanical disk (OS also on the same disk,
there is no battery/UPS):
cat
/dev/urandom >
omg.txt
If the power
losses suddenly during the process, or any other sort of ungracefully
shutdown/reset.
Will the file be
corrupted and unable to fix (i.e. none of any data can be recovered?), will there be a
chance the file system be completely unable to boot?
Answer
Will the file be corrupted and unable to fix
(i.e. none of any data can be
recovered?)
Potentially,
yes. There's 2 obvious routes via which this could
happen.
Ext4 is a metadata journaling filesystem
- it only journals the changes to the file's meta data (size, location, dates) - not the
file contents (btrfs and zfs do full-data journalling at a big performance cost). So
although you should never have to fsck the disk, it doesn't follow that every write
operation betwen opening the file and closing + flushing the buffers will have
completed. There is no transactional control over writes to the file
data.
A second possibility is that
the disk may be physically damaged by power spikes. Although the rest of the hardware
tends to do a good job of isolating the hard disk, there will still be some
leakage.
will
there be a chance the file system be completely unable to
boot?
That's a
very different question - this is a lot less likely. Certainly the first scenario only
applies if you happen to be writing the kernel, bootloader, ramdisk etc at the time of
the outage.
See also href="https://unix.stackexchange.com/questions/12699/do-journaling-filesystems-guarantee-against-corruption-after-a-power-failure">this
Q&A on unix.stackexchange
Comments
Post a Comment