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.