In a Linux Software raid, what is the best practice for periodically having the filesystems checked? With single drive or hardware raid, tune2fs -c 5 -i 1w /dev/sda1
means check the filesystem every 5 mounts or if it has been a week or more since the last mount.
But in mdadm land, there are are at least three devices that could be checked in four ways:
- echo check > /sys/block/md0/md/sync_action
- tune2fs -c 5 -i 1w /dev/md0
- tune2fs -c 5 -l 1w /dev/sdal
- tune2fs -c 5 -l 1w /dev/sdb1
I am thinking i only want to automatically do #1 and #2. Never ever do check the physical drives directly. man md
says it is not always abnormal for the physical drives to have different data because sometimes it does not matter.
A good practice is to stress the bare-metal parts of a harddrive a few times in the first 90 days. The goal is not necessarily a filesystem test, but a hardware stress test, hence e2fsck -v -f -c -c -D -C 0 /dev/md1
. This manually run forced fs check reads and writes the entire fs and orders it alphabetically while printing verbose output to stdout. md is smart enough to setup RAID across disparate harddrives, but is it smart enough to manage the badblocks list separately for each drive member? Would doing the above e2fsck upon software raid /dev/md0 mark badblocks on both drives even though a badblock exists on just one drive?
Should the member drives ( /dev/sdX ) have the same or different UUIDs as the RAID drive ( /dev/mdY ) ? If the same, it is easy to find all the members of a raid set. But if the same, tune2fs based e2fsck gets registered for both the physical member drives and software raid.