On Fri, 2020-05-15 at 06:20 -0500, Bruno Wolff III wrote:
On Fri, May 15, 2020 at 11:53:11 +0100,
Patrick O'Callaghan <pocallaghan(a)gmail.com> wrote:
> However gsmartcontrol reports that one of the HDDs has internal errors.
> Would it be best to correct these using mdadm (assuming they can be
> corrected), and if so, how? Or should I do an offline copy with the
> docking station's "clone" button?
That's not a good sign, but sometimes you can still get a lot of use out
of such a drive. If you don't want to spend effort figuring out where
the bad sectors are, you can pull the drive out of the array,
I assume that's with mdadm, right?
copy
/dev/zero to the partition (if the array is at the partition level) or
the whole disk and afterwards add it back into the array. While this
is going on if the other drive fails, you won't have a second copy. If
you screw up and wipe the good drive by mistake, you are going to lose
the data in the bad sectors. The purpose of rewriting the drive is to
trigger the drive into replacing the bad sectors with spare sectors.
(Sometimes that isn't needed if there was a bad write, but the sector
isn't really bad.) Sectors aren't replaced on reads so that you can continue
to try to recover the data on the vas sector.
I wondered if the dock's clone function would have the same effect.
> Are there any general recommendations for monitoring these
beasties? I
> don't want to change anything for the time being and will be using the
> thing mainly for backup, but I see there is such a thing as mdmon which
> isn't currently running. Should it be? I have no previous experience
> with md devices.
You can set up a cron job to run smartctl tests regularly. The config is in:
/etc/smartmontools/smartd.conf
You can also check the the array elements while also exercising the drive
to catch bad blocks doing this:
sh -c 'for raid in /sys/block/md*/md/sync_action;do echo "check" >>
${raid};done'
OK, thanks.
poc