I got a file system corruption from a sudden power loss. During boot, it reported following error.
error: unknown filesystem.
Entering rescue mode...
grub rescue> _"
The board is an Intel NUC using M.2 2242 SSD as storage. The SSD is partitioned as sda1, sda2, and sda5 for typical Ubuntu installation. I ran a liveCD and tried to fsck the ext4 filesystem, but
tune2fs -l /dev/sda1 complained.
Bad magic number in super-block ... couldn't find valid filesystem superblock.
I know a power loss may result in a file system problem. But how could it be so bad that the super block is lost? I have done the following to reduce the chance of corruption, but it still happens too often.
- disable disk write cache. (
hdparm -W 0 /dev/sda, every time it boots)
- KVM virtual machine disk image cache mode set to 'directsync'.
Halfgaar and Ts'o say that during a voltage drop, the DIMM is more sensitive and the content is garbage; whereas SSDs can last longer, thus copy wrong data from DIMM. This paper gives 6 ways for SSDs to fail, including the metadata (FTL) is corrupted. I wonder how can I determine what happened in my case.
Can somebody give example scenarios that damage the super block?