Moving linux boot loader(s)

Posted on

QUESTION :

I recently resurrected one of my old laptops as a home-server. I decided to get rid of the original windows install and get linux up and running.

The laptop has two harddrives: One SSD (/dev/sdb), and a good old fasion fridge-magnet containing PRM disk (/dev/sda). (from now on, I’ll refer to them as just SSD and RPM).

I’ve always had the OS to be on the SSD, and other stuff on RPM, and would therefore prefer to have SSD as primary, and RPM as secondary. However, because of sub-optimal chassis, I need to (or prefer to, because I’m a coward) keep them the other way around for cooling-related reasons.

Now, I can set the BIOS to just boot from the SSD, but because of various OS installs throughout the ages, I’ve ended up with this result:

  1. BIOS set to boot from RPM
  2. RPM seems to have a bootloader that just chainboots whatever is on SSD
  3. SSD boots normally. Grub even references the old Windows loader still present on RPM.

Because of some unrelated testing, I tried booting without the RPM drive installed, but then it won’t boot at all. (black screen, no info at all). I worked around this by temporarily copying the first few megabytes to a USB flash drive (using dd) and then booting from that. That allowed it to temporarily have the RPM drive disconnected.

So, my question is twofold:

  1. How do I see what kind of bootloader is present on RPM?
  2. How do I make the bootloader of SSD serve the purposes of both, so that I eventually get to remove RPM entirely? (of course, after setting BIOS to boot from SSD)

EDIT:

grubs OS-probe claims there’s a windows loader on the RPM disk

ANSWER :

Suprisingly, making a backup of the bootloader on both drives, and copying the RPM bootloader onto SSD did not work:

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

I cannot remember exactly what went wrong, but grub complained about reading outside of its boot sectors or something to that effect.

What eventually worked was:

grub-install /dev/sdb

I was, and still am, suprised at how far back and deep that one was buried in the google results I’d been combing through, considering how simple and pain free it was. Whatever was in MBR of RPM is still there, but I’ve set my BIOS to boot from SSD now, circumventing RPM entirely, allowing me to disconnect/replace it when the time comes.

Leave a Reply

Your email address will not be published.