Re: (help!) MD RAID6 won't --re-add devices?
flat view
From: Jérôme Poulin <hidden>
Date: 2011-01-16 00:05:16
On Sat, Jan 15, 2011 at 2:50 PM, Bart Kus [off-list ref] wrote:
Some research has revealed a frightening solution: http://forums.gentoo.org/viewtopic-t-716757-start-0.html That thread calls upon mdadm --create with the --assume-clean flag. It also seems to re-enforce my suspicions that MD has lost my device order numbers when it marked the drives as spare (thanks, MD! Remind me to get you a nice christmas present next year.). I know the order of 5 out of 10 devices, so that leaves 120 permutations to try. I've whipped up some software to generate all the permuted mdadm --create commands. The question now: how do I test if I've got the right combination? Can I dd a meg off the assembled array and check for errors somewhere?
I guess running a read-only fsck is the best way to proove it working.
The other question: Is testing incorrect combinations destructive to any data on the drives? Like, would RAID6 kick in and start "fixing" parity errors, even if I'm just reading?
If you don't want to risk your data, you could create a cowloop of
each device before writing to it, or dm snapshot using dmsetup.
I made a script for dmsetup snapshot on the side when I really needed
it because cowloop wouldn't compile. Here it is, it should help you
understand how it works!
RODATA=$1
shift
COWFILE=$1
shift
FSIZE=$1
shift
PREFIX=$1
shift
if [ -z $RODATA ] || [ -z $COWFILE ] || [ -z $FSIZE ] || [ ! -z $5 ]
then
echo "Usage: $0 [read only device] [loop file] [size of loop in MB] {prefix}"
echo "Read only device won't ever get a write."
echo "Loop file can be a file or device where writes will be directed too."
echo "Size is specified in MB, you will be able to write that much
change to the device created."
echo "Prefix will get prepended to all devices created by this script
in /dev/mapper"
exit -1
fi
MRODATA=$PREFIX${RODATA#/dev/}data
COWFILELOOP=$(losetup -f)
MCOWFILE=$PREFIX${RODATA#/dev/}cow
MSNAPSHOT=$PREFIX${RODATA#/dev/}snap
dd if=/dev/zero of=$COWFILE bs=1M seek=$FSIZE count=1
losetup $COWFILELOOP $COWFILE
echo "0 $(blockdev --getsz $RODATA) linear $RODATA 0" | dmsetup create $MRODATA
echo "0 $(blockdev --getsz $COWFILELOOP) linear $COWFILELOOP 0" |
dmsetup create $MCOWFILE
echo "0 $(blockdev --getsz /dev/mapper/$MRODATA) snapshot
/dev/mapper/$MRODATA /dev/mapper/$MCOWFILE p 64" | dmsetup create
$MSNAPSHOT
echo "You can now use $MSNAPSHOT for your tests, up to ${FSIZE}MB."
exit 0
--Bart
-- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html