0

I have custom desktop computer and I am looking to finish setting up my Ubuntu installation. I am trying to move the bootloader and GRUB for the Ubuntu installation to the disk where Ubuntu is installed.

I have multiple internal drives, but for this question only 2 of them matter. The first is a Samsung 960 Pro 1TB NVME SSD (device /dev/nvme0n1). The second is a Samsung 850 PRO 1TB SSD (device /dev/sdg). I have windows installed on the 960 Pro and Ubuntu installed on the 850 Pro.

The 850 Pro has the following partition structure:

  • 512 MB EFI Partition
  • 64 GB Ext4 @ /
  • 64 GB Swap
  • 870+ GB Ext4 @ /home

When I went through the Ubuntu installation GUI, I created this schema and selected /dev/sdg1 in the 'Device for boot loader installation' menu. However, it seems that this selected was ignored and the boot loader was installed onto the 960 Pro. The UEFI BIOS of my Motherboard (Rampage V Edition 10) indicates this as the location of the boot loader for the Ubunutu installation. When I select, I boot into the GRUB menu with options to boot Ubuntu or boot Windows. When I boot into Ubunut, I can see that the EFI partition on the 960 Pro (/dev/nvme0n1o2) is mounted at /boot/efi using the disk utility application.

How do I move the Ubuntu bootloader to use the EFI partition on the 850 Pro SSD (/dev/sdg1)?

1

You should first be aware that moving the Ubuntu boot loader is not necessary in your situation, unless there's something about your setup that you haven't described. As any attempt to move the boot loader runs a risk of failure that could render Ubuntu, and conceivably even Windows, unbootable, this is likely to be a case of "if it ain't broke, don't fix it."

That said, if you want to move GRUB (Ubuntu's boot loader), you can do so in a few steps:

  1. Unmount /dev/nvme0n1o2 by typing sudo umount /boot/efi.
  2. Find the serial number ("UUID," although technically it's not a UUID) of the target ESP by typing sudo blkid /dev/sdg1. (This step assumes that the SSD already has a FAT filesystem on it. If not, you'll need to create one with mkdosfs.)
  3. Edit /etc/fstab: Locate the line that defines /boot/efi and edit it so that it refers to /dev/sdg1 rather than /dev/nvme0n1o2. The best way to do this is to change the "UUID" from whatever it is now to the value you obtained from blkid in the previous step.
  4. Type sudo mount -a to mount the new ESP.
  5. Type df /boot/efi to verify that the new ESP is mounted at /boot/efi. (If it's not mounted, df will report information on / or /boot, not /boot/efi.)
  6. Type sudo grub-install. This installs GRUB, but leaves it unconfigured.
  7. Type sudo update-grub. This configures GRUB.

This should be all that's needed, unless I'm forgetting something (which is certainly possible). If it doesn't work, the system will probably continue to boot through the old GRUB, which remains installed, but inactive, on /dev/nvme0n1o2. You can delete the EFI/ubuntu directory from that partition if you want to fully uninstall GRUB from there.

  • My biggest reason for moving the Ubuntu boot loader is due to issues with Windows Updates. The Windows 10 Creators Update messed with a previous dual boot setup by touching the EFI partition on the Windows disk (The Samsung 960 Pro). By moving the Ubuntu boot loader away from that disk, I am hoping to avoid similar issues. 2 points of clarification. 1: What is the risk of leaving the old grub installation on the EFI partition at /dev/nvme0n1o2? 2: Correct me if I am wrong, but shouldn't the EFI Partition created by the Ubunutu Installer should already be formatted as FAT. – Andrew Oct 17 '17 at 22:09
  • There's no guarantee that Windows won't touch the Ubuntu ESP, no matter where you put it. Also, it's unclear from your description if Windows actually modified the ESP, or just adjusted the boot order, which it would be no less likely to do if you use a separate Ubuntu ESP. There's no real risk of leaving an old GRUB lying around, although it could cause confusion if you need to adjust things later. An ESP uses FAT, according to the EFI spec. Whether a partition with an ESP type code actually is FAT is another matter. Depending on how you prepared it, that might or might not be true. – Rod Smith Oct 21 '17 at 14:41
  • 1
    I followed the steps you provided and they sufficient to move the Ubuntu boot loader to the ESP on the Ubuntu disk. Thanks! The windows update actually erased the GRUB install on the EFI Partition of the Windows disk. I am hoping that by moving the Ubuntu bootloader to a second disk that future windows updates won't touch it. I am hoping that Microsoft will assume that the only bootloader it needs to worry about is the one on the Windows disk. I agree that is not a guarantee, but at least it is something. – Andrew Oct 22 '17 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.