Hi,

Not an expert on this matter, so take this with a grain of salt.

Le 09/09/2024, Andy Smith <a...@strugglers.net> a écrit:

> Can I simply copy the first 512 bytes of sdb to the start of sda?

I would not do this, one of the reasons being that AFAICT, the start
offsets of the (up to 4) primary partitions of each drive are among
these bytes.

> I do not particularly want to run grub-install, as the MBR of sdb is
> known good at the moment. Perhaps though I could run:
>
> $ sudo grub-install /dev/sda

I believe so, although by habit I'd rather 'dpkg-reconfigure grub-pc'
where you can IIRC select the drives to act on (it will remember your
selection, so in case you don't select sdb in the debconf dialog for
fear of breaking it, next time GRUB is updated on that system, your sdb
GRUB installation would become out-of-date). Of course, I am assuming
the computer boots with BIOS, not UEFI.

(Keep a rescue disk, installation medium or Debian Live around, in case
there is a problem booting afterwards.)

> and then compare again the first 512 bytes of each drive?

Out of curiosity, I skimmed through [1] and computed the offsets of your
"GRUB " strings as they would be found in memory when the code is run at
boot (adding 7C00h, AFAIUI). I found 7D88h for your sda and 7D80h for
your sdb, none of which matches the values at [1] under heading
“Location of the GRUB ID String and Error Messages in Memory”. Thus, my
understanding is that both of your MBRs were probably written by GRUB 2
(I wanted to check if maybe one had been written by GRUB 1 and the other
by GRUB 2).

Regards

[1] https://thestarman.pcministry.com/asm/mbr/GRUB.htm

-- 
Florent

Reply via email to