Debian – Creating a partitioned raid1 array for booting a debian squeeze system

debiangrubmdadmsoftware-raid

I'd like to have the following raid1 (mirror) setup:

/dev/md0 consists of /dev/sda and /dev/sdb

I created this raid1 device using

mdadm --create --verbose /dev/md0 --auto=yes --level=1 --raid-devices=2 /dev/sda /dev/sdb

This gave a warning about metadata being 1.2 and my system might not boot. I cannot use 0.9 because it restricts the size of the raid to 2TB and I assume grub shipped with latest debian (squeeze) should be able to handle metadata 1.2.

So then I created the needed partitions like this:

# creating new label (partition table)
parted -s /dev/md0 mklabel 'msdos'

# creating partitions
sfdisk -uM /dev/md0 << EOF
0,4096
,1024,S
;
EOF

# making root filesystem
mkfs -t ext4 -L boot -m 0 /dev/md0p1

# making swap filesystem
mkswap /dev/md0p2

# making data filesystem
mkfs -t ext4 -L data /dev/md0p3

Then I mounted the root partition, copied a minimal debian install inside and temporary mounted /dev /proc /sys. Afer this I chrooted to the new root folder and executed:

grub-install --no-floppy --recheck /dev/md0

However this fails badly with:

/usr/sbin/grub-probe: error: unknown filesystem.
Auto-detection of a filesystem of /dev/md0p1 failed.
Please report this together with the output of "/usr/sbin/grub-probe –device-map=/boot/grub/device.map –target=fs -v /boot/grub" to

I don't think it's a bug in grub (so I didn't report it yet) but a fault of mine. So I really wonder how to properly setup my raid1, everything I tried so far failed.

Best Answer

You should install grub on your disks MBR, not on /dev/md0, so run grub-install /dev/sda ; grub-install /dev/sdb. Is this work better ?