Updated : Apr 28, 2016 in Linux

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.


    1. Sorry, I’ve never done it on RAID 0. Only on RAID 1(Easy). My guess is that it all depends on the type of RAID: Software or Hardware.
      For software RAID 0, I would think that if the size of grub which is written normally in the MBR is not bigger than the RAID 0 stripe size, then it should not be any problem and grub could be written on the first physical drive seen by BIOS. But that is only speculations.
      On the other hand, with Hardware RAID 0, then my guess is that grub can be installed just the same way as on a single drive since the RAID 0 bundle is seen by the BIOS as a single drive, even though the data is being ‘stripped’ on multiple physical drives. Good luck.

  • Well, i do not know how to do it with mdadm, but Grub2 can boot from inside LUKS that is inside another LUKS that is inside LVM that is inside … etc.

    And with LVM you can do Raid 0 (or better said: stripping).

    So my guess is to create a LVM over multiply disks, then install Grub2 over a logical volume.

    My guess is starting with something like what is on this web:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: