2

Some systems run fsck on every boot, after so many days, or after so many mounts. For example, in How often should I reboot Linux servers? - Server Fault they discuss a variety of strategies for doing so. Why is this necessary? Without some background, it's hard to pick a strategy.

In Marc's Blog: btrfs - Btrfs Tips: Btrfs Scrub and Btrfs Filesystem Repair, the author claims this isn't necessary if you have a btrfs filesystem, and in Data degradation - Wikipedia they discuss similar self-healing features in zfs. Perhaps this is an ext4 specific requirement?

In Drives with Integrity - Designing for Zero Silent Data Corruption Tolerance they imply that cosmic rays aren't a factor when it comes to disks. Could data corrupted in the CPU make it on disk, though, partially explaining the need to run fsck? Still, I see almost no discussion around fsck in statistics - Cosmic Rays: what is the probability they will affect a program? - Stack Overflow.

2
  • 1
    Where did you read about xfs in the Wikipedia page ? I see ZFS, Btrfs (which makes is inspired by ZFS), ReFS. That’s it. Feb 11, 2022 at 22:10
  • Thanks @FrédéricLoyer, I misread it. Fixed. Feb 11, 2022 at 22:49

1 Answer 1

4

The idea behind ZFS and Btrfs is to store each block twice or more, and the pointer(s) on each of these blocks have a checksum.

If something wrong happens, the checksum is used to decide which bloc is the good one. Scrubbing is the background task which verify that each bloc is ok (comparing the checksum). Then everything is verified.

Fsck is a less deep verification. It is used typically on filesystem which may have some inconsistant meta-data. It will check for example that a bloc which is marked free is not used by a file and other issues like this. It was done when filesystem could get corrupted by a power shortage, a kernel panic or other such issues. Nowadays, filesystems have journaling function (or other function like copy-on-write) which prevent such inconsistencies. Fsck is no longer needed in most cases, excepted if there is data degradation (but Fsck is very limited). Note : FAT has no journaling. If you remove a USB drive with no care, you may need to run fsck on it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .