2

When and how should this be run? Is it better to boot from a DVD-ROM and run fsck on each real hard drive? Or can this be done automatically after X number of mounts?

Edward_178118
  • 895
  • 4
  • 14
  • 30
  • Possble duplicate of http://serverfault.com/questions/674694/how-to-have-automatic-file-system-checks-for-linux-software-raid/674728 – Paul Haldane May 10 '15 at 10:28

2 Answers2

5

The answer to when to run fsck on the underlying physical disks is very simple:

Never

If you are using RAID-1 the fsck command might not notice you are using it incorrectly and perform an actual check. If that check results in any writes to the disk, you will end up with a RAID where the disks are out of sync.

Having metadata out of sync between RAID replicas can potentially lead to data loss.

The correct way to check your RAID

Periodic checks of the file system metadata are to be performed on the logical layer above the RAID. This is done as part of the boot process, and there is a good chance this is already configured for you.

Periodic verification that the replicas are readable and in sync is also a good idea. This happens at a lower layer and doesn't check any integrity at the file system layers. On one of my servers I can see that these checks are happening by inspecting the output of

dmesg | grep data-check
kasperd
  • 29,894
  • 16
  • 72
  • 122
4

fsck stands for 'file system consistency check', it checks a filesystem, not the underlying disks - as such it should be used to testing the entire filesystem. As for periodic automatic fsck executions look at your /etc/fstab file, it's in that file that we can define automatic checks.

Chopper3
  • 100,240
  • 9
  • 106
  • 238