[CentOS] *very* ugly mdadm issue

Tue Sep 2 20:07:34 UTC 2014
GKH <xaos at darksmile.net>

Hmm, very bad idea to create a file system on the raw disk.
The swap type partitions know how to handle this well
but for a partition with data why take the chance that
something will write the MBR there. That's what happenned
I bet.

The procedure is this:

Create a partition 1 on the new unused drive (use all space).
That leaves space for the MBR.

Create the mirror on this new drive, use "--missing"
mkfs -t ext4 on the new disk

mdadm -D /dev/mdx (where x is the number of the mirror)
should show 1 drive on the mirror.
cat /proc/mdstat should show same thing.

Now, copy the data from the old disk to the new
"mirrored" disk.

When done, reboot. Yes, reboot now. If something had
gone very wrong you would not lose your data
and you would see your data on both disks.

Ok, you rebooted, you see the data on both disks.
Do fdisk the old disk. Create one partition,
add the partition to the mirror, wait for sync to end
and reboot again.

You should be able to see your data mirrored.

..That's the right way!

Ok, so you did not do this and something tried to
write the MBR in the raw disk and you lost all your data???

Well maybe.

Try using fsck with alternate superblocks. The first superblock
should be 32.

Good luck dude.

GKH.