All of lore.kernel.org
 help / color / mirror / Atom feed
* Monitor new badblocks
@ 2015-03-24 17:30 Serge Bartosh
  0 siblings, 0 replies; only message in thread
From: Serge Bartosh @ 2015-03-24 17:30 UTC (permalink / raw)
  To: linux-raid

Hello all,

since md started to support of BadBlockList(Log) I'm trying to find 
answer to question:
- is there a possibility to get alarm when md discovers new bad blocks?

Please correct me if I'm wrong but I suspect that answer will be "no".

According to man page possible Events are:
DeviceDisappeared, RebuildStarted, RebuildNN, RebuildFinished, Fail, 
FailSpare, SpareActive, NewArray, DegradedArray, MoveSpare, 
SparesMissing, TestMessage

There is no special event for new badblocks discover and I've checked 
today that bad blocks existence is not the reason to mark device "Fail".
I've made experiments with dmsetup simulating "bad surface": even when 
new disk containing 90 percents of unusable sectors is added to array md 
makes and finishes recover without kicking disk out. Last event is 
SpareActive. Syslog does not contain lines about md found bad blocks on 
new disk. Array is clean and active.

I understand that manual command "mdadm --examine-badblocks" reveals 
such hidden problem.
But is there a way to make "mdadm --monitor" to warn about bad blocks?



PS. System is Debian Jessie RC1

root@linux-test-vb:~# mdadm --version
mdadm - v3.3.2 - 21st August 2014
root@linux-test-vb:~# uname -a
Linux linux-test-vb 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt7-1 
(2015-03-01) x86_64 GNU/Linux
root@linux-test-vb:~# cat /etc/debian_version
8.0


PPS. Script used for experiments:
-----8<-----
#!/bin/bash

MDNAME=/dev/md999
DISKSZ=$((64*1024*1024))

#cleanup
echo cleanup
mdadm --stop $MDNAME
dmsetup remove bad_disk4

echo making files and loops
for i in `seq 1 4` ; do
     losetup -d /dev/loop$i;
     dd if=/dev/zero of=f$i bs=1M count=$((DISKSZ/1024/1024))
     losetup /dev/loop$i f$i;
done

echo
echo making faulty disk4 with bb somewhere in the middle...

DEV=/dev/loop4
SECTORS=`blockdev --getsz $DEV` #size in sectors
SECTSZ=`blockdev --getss $DEV` #size of sector

BBPOS=$((SECTORS/2)) #bad block position
BBLEN=$((SECTORS/4)) #bad block region length
echo badblock region from $BBPOS to $((BBPOS+BBLEN)) of $SECTORS
dmsetup create bad_disk4 << EOF
   0         $BBPOS   linear /dev/loop4 0
   $BBPOS    $BBLEN   error
   $((BBPOS+BBLEN)) $((SECTORS-BBLEN-BBPOS)) linear /dev/loop4 
$((BBPOS+BBLEN))
EOF

echo
echo making initially degraded raid6
mdadm --create $MDNAME -l 6 -n 4 /dev/loop[123] missing
echo waiting for recover finish...
while [ `cat /sys/block/md999/md/sync_action` != 'idle' ]
do
         sleep 1
done
echo adding bb disk
mdadm --add $MDNAME /dev/mapper/bad_disk4
-----8<-----

-- 
WBR,
Serge Bartosh


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-24 17:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 17:30 Monitor new badblocks Serge Bartosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.