I have a laptop which is running windows 10 and I want to install Ubuntu on an external HDD and whenever I need it I can just plug it in and boot from the external drive.
I've followed a tutorial, actually two, and both said that the bootloader has to be installed on the external HDD. This had as a result that I could only access Windows when I had the external HDD plugged in. Whenever I didn't have it plugged in the laptop wouldn't boot and I would just get a black screen with a white line. After fixing my master boot record I could access windows.
Now I want to try again but I'm afraid that if I install the bootloader on the internal drive that I might somehow delete my windows partition or I will have problems with my bootup.
So what should I do?
Best Answer
First, it's CRITICAL that you understand your boot mode. Modern computers can boot in either of two ways:
Since you mention Windows 10, chances are your computer is EFI-based and boots in EFI mode. I'll proceed under that assumption. If this is incorrect, ignore the rest of this answer.
To boot an internal disk in EFI mode, the OS typically stores a boot loader as a file on the EFI System Partition (ESP) on the disk. This filename can be anything legal, but for Ubuntu it will be
EFI/ubuntu/shimx64.efi
, which in turn launchesEFI/ubuntu/grubx64.efi
. The OS installer registers the name of the boot loader with the EFI's built-in boot manager, which stores that name in NVRAM. If the EFI works correctly (not all do), this results in a working boot process.The trouble with this process, as applied to a removable disk, is three-fold:
/boot/grub
directory, which is not likely to be on the ESP. Thus, if Ubuntu installs GRUB to the ESP on your internal disk, you'll avoid the first problem but run into another one because when you start up with the USB drive disconnected, GRUB will launch and be unable to find its configuration files. The result is agrub>
prompt that will mystify most users.There are a number of solutions to these problems, including:
EFI/BOOT/bootx64.efi
. If you copy Shim (which launches GRUB) to this filename (by copyingEFI/ubuntu
toEFI/BOOT
on the ESP and then renamingshimx64.efi
tobootx64.efi
inEFI/BOOT
), your firmware will be able to launch your USB-based GRUB just as it did the Ubuntu installer. This will work past both of the problems I've just identified, but you'll need to use the computer's built-in boot manager to select which OS to boot. This built-in boot manager ranges from unusable to tolerable, so this might or might not be an acceptable solution. You may also need to tweak your boot order after you install Ubuntu to keep it from launching GRUB from either the internal disk's ESP or the external disk's ESP by default./boot
partition on your internal disk -- If you install GRUB to the internal disk, then you can also put a/boot
partition on the internal disk. This will enable GRUB to work normally on all boots; however, the Ubuntu option will appear all the time, even when the USB disk is unplugged. This may be undesirable, especially if Ubuntu is the default. Also, this solution means that your external USB drive will be bootable only on the computer on which you prepared it. If you want to be able to use that disk on other computers, you should avoid this solution.default_selection
option inrefind.conf
appropriately, you can configure rEFInd to boot Ubuntu automatically if your Ubuntu USB drive is plugged in and to boot straight to Windows if the Ubuntu USB drive is not plugged in. My answer to this question provides more details about this type of configuration, albeit on a Mac rather than a PC.With any luck, one of these approaches will get you up and running.