MAC OS X, Linux, Windows and other IT Tips and Tricks

28 Apr 16 Installing GRUB2 on mdadm software Raid in Debian Wheezy/Jessie

If you look at the result of the command df -h and you are using the mdmadm software RAID 1 then you can only see the /dev/mdx partitions.
Filesystem Size Used Avail Use% Mounted on
/dev/md2 1.8T 524G 1.2T 31% /
udev 10M 0 10M 0% /dev
tmpfs 3.1G 288K 3.1G 1% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 9.3G 0 9.3G 0% /run/shm
/dev/md1 496M 77M 394M 17% /boot

Since the command ‘grub-install /dev/md0’ or ‘grub-install /dev/md0’ produces an error, the main principle is to install GRUB on both drives that constitute the components of software RAID 1.

In order to allow any of the two hard disks to boot using GRUB the following line must be disabled in the file /etc/default/grub:
Now we need to register all the drives that constitute the software RAID drives.
grub-mkdevicemap -n
We find out which of the drives(not partitions) are used for the RAID
fdisk -l | grep 'Disk /dev/sd'
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors

We update the GRUB configuration:
Finally we install GRUB on both of the above listed drives(/dev/sda and /dev/sdb)
grub-install /dev/sda ; grub-install /dev/sdb
Now each drive can be used to start the system.