User Tools

Site Tools


linux:software_raid_grub

GRUB2 on mdadm software Raid in Debian

Principle: 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. eg.

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.

STEPS: 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:

GRUB_TERMINAL=console

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'

eg:

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:

update-grub

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.

linux/software_raid_grub.txt · Last modified: 2017/12/14 09:47 by admin