Grub On Multiple Drives?

13,211

Solution 1

If system really UEFI which all newer system are and Windows is installed in UEFI boot mode, these instructions will not apply.

When installing and if BIOS, you should use Something Else install option and select which drive's MBR you install grub into. You would only want it on the external drive, then set external drive as first in BIOS drive boot order and then if not found it should default to next in drive boot order.

To fix it, now, you want grub installed to MBR of external drive and Windows boot loader in internal drive. And BIOS set to boot external drive first.

You can use Boot-Repair install a Windows type boot loader to Windows drive. Do not run auto fix with Boot-Repair, as that installs grub everywhere. Or use Windows repair disk and run the Windows fixes (fixMBR) to restore Windows boot loader to MBR.

If booted into Ubuntu you can directly install grub to MBR of external drive directly. Or you can use Boot-Repair's advanced options and choose install and drive to install boot loader.

reinstall from working (not liveCD/DVD/USB) system - first find Ubuntu drive (example is drive sdb but use your drive not partitions):

sudo parted -l

if it's "/dev/sdb" then just run:

sudo grub-install /dev/sdb
sudo update-grub

https://help.ubuntu.com/community/Boot-Repair

Best to also have Windows repair disk, to fix Windows when needed as Boot-Repair is primarily for Linux and can only do a few minor fixes for Windows.

Solution 2

The installation of grub has 2 parts: the resource files, and the boot loader. [Concerning non UEFI boot] Each OS installation has its own resource files [located in the same partition than the OS you have installed), but the boot loader is always installed on the master boot record. Effectively, the boot loader that is installed later will overwrite the former. In that sense, you can have only one full functional grub at a time.

So, don't worry, one of your grub is not functional.

The fact that your Windows, on the non-removable disk, cannot boot with the help of the Linux removable disk, means that your boot loader has a part that is needed located in the Linux partition, as I wrote, there are 2 parts.

(...) I either have 2 grubs, which doesn't make sense, or I lose the option to boot into Ubuntu when my hdd is connected if I do the windows repair thingy.

No, you have only one that is functional. The one with the 2 parts, one has now only one part, as the Linux one rewrote your MBR.

In your case, you had first Windows installing its bootloader in the MBR of your non-removable drive, and after that, you installed a Linux distro, and you probably didn't use the option "Install Linux next to Windows" (dual boot), so the only (MBR-)bootloader that remained was the Linux one, as you didn't specify explicitly to keep the ability to boot Windows during the install.

I had problems sometimes with install that installed the MBR in the wrong partition, I think it happens.

I googled online and what I found out is that I either have to install grub on my primary drive; or use a windows recovery disc to repair the MBR.

As you have 2 disks, you can have 2 functional grub, the Windows grub in the MBR of your Windows disk, and the Linux grub in the MBR of your removable disk.

You can use a live CD/USB (everyone should have one to fix bad things that happens to boot, more often than we think).
A live CD with any distro, and an ethernet cable, and you download boot-repair,
or a boot-repair disk: To download here or here.

(For people who cannot boot from the live CD or USB, obviously, they have to change the boot order in their bios.)

You can make a bootable disk with Rufus or Unetbootin for instance.
Tutorial: https://linuxhint.com/ubuntu_boot_repair_tutorial/

There are other disks that can help you alternatively, like Hiren boot (this one is very good as you can use both Windows and Linux to repair your system, from the same ISO), System Rescue CD, SuperGrub disk, Rescatux, Grub-customizer (not live CD), etc...

And of course, as it's a double boot, you can use the Windows method (I consider the Linux one as safer through).
It's not confusing, there are several methods to do that. You can use the Windows MBR restauration at the condition your Linux disk is unplugged, and then, you will have a fully functional Windows MBR. In this case, it won't be a dual boot, but you will tell that you want to boot from the disk or from the removable media, alternatively.

More info: https://help.ubuntu.com/community/Grub2/Installing#via_the_LiveCD_terminal

Next time, to avoid this kind of problem, follow the recommendations:

nstalling Ubuntu to a Specific Partition ("Something Else"):

*When using the "Something Else" option, you will be offered to choose the "Device for bootloader installation". Please select: * either the disk (eg /dev/sdX, not /dev/sdXY) on which the BIOS is setup to boot (recommended for normal use) * OR the partition (eg /dev/sdXY, not /dev/sdX) on which Ubuntu (/boot, else /) will be installed (only if you want to chainload it from another bootloader; if any doubt, do NOT choose this)*

Never choose any other partition! (this may break the boot of your other systems, see Bug #1049549).

On a system with multiple drives and OS's, the user can preserve the original bootloader by installing GRUB 2 on another drive. To accomplish this: specify the disk (eg /dev/sdX, not /dev/sdaXY) not currently used to boot the system for the bootloader location. After the installation is complete, change the boot order (via BIOS setup) so that the disk to which the GRUB information was written is the one booted first. If the user wishes to restore booting with the original bootloader, change the boot order back to the original drive.

GRUB 2 normally writes its bootloader information to an area just beyond the Master Boot Record and before the first partition. Some software on non-Linux operating systems also used this embedded area and broke the system by overwriting the GRUB 2 information on dual-boot systems. GRUB 2 now can recognize this potential problem and avoid it.

The bootloader information does not have to be installed to the embedded area of the MBR. It may also bypass the MBR entirely and be installed to a specific partition. In doing this, the location of the GRUB 2 files are specified by using blocklists. This option is not available via an Ubuntu GUI installation but can be made via the terminal after installation. Even then this method is not as reliable as writing to the MBR and is not recommended by the GRUB developers.


Fixing with the Windows method:
https://www.pagestart.com/repairwin7dualboot02.html

With a Windows CD/USB: Choose “Install Now”, and then "Repair your computer'

System recovery options >> Command prompt >> Diskpart

Tuto here

bootrec.exe /fixmbr
bootrec.exe /fixboot
bootrec.exe /RebuildBcd

Share:
13,211

Related videos on Youtube

Andrija Radica
Author by

Andrija Radica

The quieter you become, the more you are able to hear.

Updated on September 18, 2022

Comments

  • Andrija Radica
    Andrija Radica over 1 year

    My laptop (ASUS ROG G752) has 2 SSDs.

    At first, I installed Windows (BIOS) on the smaller and faster 256GB one (NVMe),
    and used the larger 512GB(SATA) one for games & programs.

    Recently I got an external hard drive and I wanted to try out Ubuntu :D,
    so installed it there thinking I'd start using it more and increase the lifespan of my SSDs.

    Well, now my Windows system cannot boot without the external drive because grub is there.

    I don't want my entire system to be dependent on that drive obviously.

    I googled online and what I found out is that I either have to install grub on my primary drive; or use a windows recovery disc to repair the MBR.
    Both answers confuse me because I either have 2 grubs, which doesn't make sense, or I lose the option to boot into Ubuntu when my hdd is connected if I do the windows repair thingy.

    Did I get something wrong?

    TL;DR: I want to be able to boot into Windows on my primary SSD when I don't have my external drive connected and still be able to boot into Ubuntu when I do have it. I'm not a total noob, but I don't feel confident with the information I got online to proceed. Any help is appreciated!

    • oldfred
      oldfred over 5 years
      If BIOS, you should use Something Else install option and select which drive's MBR you install grub into. You would only want it on the external drive, then set external drive as first in boot order and if not found it should default to next in drive boot order. From Ubuntu install grub to external drive and with Boot-Repair install a Windows boot loader to Windows drive. Do not run auto fix with Boot-Repair, as that installs grub everywhere. help.ubuntu.com/community/Boot-Repair Best to also have Windows repair disk, to fix Windows when needed.
    • Fabby
      Fabby over 5 years
      @oldfred that's an answer, not a comment. Post it as an answer and ping me and I'll come back and upvote! ;-)