1

I want my server to boot without manual intervention on degraded RAID1 from second drive on Debian 10 (Buster).

It boots when I detach the second hard disk but it doesn't boot when I detach the first one.

I have:

lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda       8:0    0 74.5G  0 disk  
├─sda1    8:1    0  953M  0 part  
│ └─md0   9:0    0  952M  0 raid1 /boot
├─sda2    8:2    0 11.2G  0 part  
│ └─md1   9:1    0 11.2G  0 raid1 [SWAP]
└─sda3    8:3    0 62.4G  0 part  
  └─md2   9:2    0 62.4G  0 raid1 /
sdb       8:16   0 74.5G  0 disk  
├─sdb1    8:17   0  953M  0 part  
│ └─md0   9:0    0  952M  0 raid1 /boot
├─sdb2    8:18   0 11.2G  0 part  
│ └─md1   9:1    0 11.2G  0 raid1 [SWAP]
└─sdb3    8:19   0 62.4G  0 part  
  └─md2   9:2    0 62.4G  0 raid1 /

First: I've tried to set "BOOT_DEGRADED=true" in /etc/initramfs-tools/conf.d/mdadm but in Debian 10 it doesn't exist.

Second: I've installed grub on the both of the disks:

grub-install /dev/sda
grub-install /dev/sdb

...but it looks like (but I'm not sure) no matter on which hard disk it is installed it always try to boot from the first disk.

Third: I've installed grub (legacy) and I've tried to set hd0 to point to the second disk:

apt-get install grub
...
grub
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> quit

No success:

grub> setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... no

Error 2: Bad file or directory type

Is there any other way to do it boot no matter which of the two hard disks is removed?

Edit: When I've tried again the Second option worked for me. However I'll leave the question - it could help to others.

Trayan Momkov
  • 163
  • 1
  • 7

1 Answers1

2

Some (older) BIOSs only allow booting from the first connected drive.

I have a similar setup/BIOS (both HDDs have grub properly installed) - I can only boot from the drive physically connected to the first SATA port regardless of which drive is specified as attached to the RAID (mdadm). Should the first drive fail I must then swap the cables and it boots into a degraded array normally.

Peleion
  • 293
  • 1
  • 5
  • Thank you for the answer @Peleion! My BIOS is old - Phoenix from 2008, but not too old. I've tried the first drive on all of SATA ports and it works. Then I've tried the second drive and it also worked :D It looks like the **Second** option worked. I was thinking to delete the question but I see that it is already useful to others so I'll leave it. – Trayan Momkov May 12 '20 at 07:37