Score:1

How to boot debian from both drives from a MD-RAID1 with LVM

id flag

i use a debian box with a MD-RAID1 with two drives and a LVM. My problem is that, obviously, i#m only able to boot from the first drive, but not the second.

root@myhost:/home/myuser# fdisk -l
Disk /dev/sda: 447,1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes                     
Sector size (logical/physical): 512 bytes / 4096 bytes                     
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xdd0f9cf2                                      

Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1  *     2048 937701375 937699328 447,1G fd Linux raid autodetect

Disk /dev/sdb: 447,1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes                     
Sector size (logical/physical): 512 bytes / 4096 bytes                     
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x30a70a91                                                       

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1        2048 937701375 937699328 447,1G fd Linux raid autodetect

Disk /dev/md0: 447 GiB, 479967838208 bytes, 937437184 sectors                          
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x91da7a92

Device     Boot  Start       End   Sectors   Size Id Type
/dev/md0p1          63    498014    497952 243,1M 83 Linux
/dev/md0p2      498076 937424879 936926804 446,8G  5 Extended
/dev/md0p5      498078 937424879 936926802 446,8G 8e Linux LVM

a boot record is available only on the first drive

root@mybox:/home/myuser# dd if=/dev/sda bs=512 count=1 | xxd | grep -i grub
1+0 Datensätze ein
1+0 Datensätze aus
512 Bytes kopiert, 6,1662e-05 s, 8,3 MB/s
00000180: 7de8 2e00 cd18 ebfe 4752 5542 2000 4765  }.......GRUB .Ge
root@Iteanova018:/home/iteanova# dd if=/dev/sdb bs=512 count=1 | xxd | grep -i grub
1+0 Datensätze ein
1+0 Datensätze aus
512 Bytes kopiert, 4,4592e-05 s, 11,5 MB/s

i then copied the boot record to second drive

dd if=/dev/sda of=/dev/sdb bs=446 count=1

but was still not able to boot from the second drive.

The reason for that is that i want to replace the drives witrh bigger ones, which is no problem with the second drive, but with the first cause as soon as i remove the first drive, i gopt no boot any more.

How can i get both drives to boot the system?

Nikita Kipriyanov avatar
za flag
Run `grub-install /dev/sda` and `grub-install /dev/sdb`. Don't copy boot code by hand; grub places something also into sectors that follow the MBR or into special biosgrub partition, so just your dd is not sufficient. Oh, and in case you use EFI, you need to have two separate ESP (on each disk) and setup booting from either one with efibootmgr. I've explained that somewhere here or on unix stackexchange, too lazy to search for it, please look it up yourself, please.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.