I have a RAID5-array consisting out of 6 1TB drives. Recently with hardware changes i needed to recreate the raid to rewrite the bootloader on each drive.
Now the problem starts. Starting the Debian rescue system, a mdadm --create occured. So far, bad situation.
I've tried to reassemble the device, but the original settings are no longer available. When i use
mdadm --examine --scan
the output only shows the array created on 27th of April 2015, the original raid was created in December 2012.
I've recognized that during the build command, the order of the drives is important. That put me in to the situation to probe each kind of combination. So far, we have 6! = 720 different possibilities to plug all devices.
Automated it with iterations on the partions with:
mdadm --create /dev/md0 --readonly --level=5 --assume-clean --raid-devices=6 /dev/sdd2 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdf2 /dev/sde2
Got only 44 combinations which addressed a working LVM records beyond it. I've though i've got it.
The actual problem starts now. When i run:
pvscan
The volume is shown and activated, all three volumes are listed:
nas-root
nas-swap
nas-storage
The problem is now, that in each of the 44 combinations i cannot mount the system.
It shows me an error that the NTFS signature is invalid. But there should be a ext3/4-filesystem on it.
Is it possible that assembling the array in the right order but with the wrong strip size this could happen?
As i created the array in December 2012 I assume to have used the default settings, means 512 chunksize, left-symetric raid5.
Is it safe for the underlying data when i run multiple
mdadm --create ... --chunk=X /dev/sd* (in different order)
Additional Note:
vgscan prints with -d that it is running on a degraded raid. Maybe this could be the problem? But how to fix it?
Additional Help:
To support full tests, i've created a read-only overlay on the raid (as i don't have space to image all 1 TB disks).
For other users this might be useful:
#!/bin/bash
dev=$1
tmp="/tmp"
if [ "no$dev" == "no" ]; then
echo "Usage $0 /dev/sdx."
echo "Overlays are placed in $tmp"
exit 1
fi
base=`basename $dev`
ovl="$tmp/overlay.$base"
if [ -e $ovl ]
then
rm $ovl
fi
truncate -s50G $ovl
newdev="$base-ovl"
size=$(blockdev --getsize "$dev")
# you need to have enough loop devices
loop=$(losetup -f --show "$ovl")
printf '%s\n' "0 $size snapshot $dev $loop P 8" | dmsetup create "$newdev"
You can also bind an image to a loopback and connect it to an overlay.
What helped me so far: