Checking badblocks in soft raid setup

Use case

2 hdd in raid 1 using md, smartd signals:

Device: /dev/sda [SAT], 8 Currently unreadable (pending) sectors


1. Run smartctl on each disk, wait and check the results

smartctl -t long /dev/sda
smartctl -t long /dev/sdb
#wait a looong time
smartctl -l selftest /dev/sda
smartctl -l selftest /dev/sdb

sdb is ok but sda confirms the smartd error:

# 2  Extended offline    Completed: read failure       60%      4832         2519297024

2. In a non raid environment I would revert to the other case but I would not do a dd on an active raid volume or on the md volume itself since at least one copy should be ok.

3. One solution is to mark the disk as failed and revert to handling badblocks on a single disk.

4. A better solution is to do a:

echo check > /sys/block/mdX/md/sync_action

to force a md check. This in turn should force the disk firmware to mark the bad block.

5. Do a smartctl again to check for errors.

6. Please note that this is the most optimistic approach to this case. It is based on the hope that only a very few bad blocks exists. It might be possible that the disk is broken and requires change.

Leave a Reply