I have quite an issue here so I've installed Ubuntu on an external SSD with 500gb.However Ubuntu boot loader or grub is installed on my internal drive along side with my Microsoft windows boot loader. I want to make my external drive completely portable and I want to be able to use it on any computer in boot into Ubuntu but I cannot. How can I copy the grub or EFI file into my external drive?
-
You need an ESP - efi system partition on external drive. Standard install probably did not add that. You can add it anywhere within the first 2TB of a drive, but usually it is first or second partition as FAT32 with boot,esp flags if using gparted. External drives boot from /EFI/Boot/bootx64.efi, not an "ubuntu" entry or drive like live installer. You can create entry as in answer below but of course that entry only works on system you use to update grub entry. Use live installer to add ESP, and if you can boot system, you can edit fstab with new UUID, refresh mounts & reinstall grub. – oldfred May 18 '22 at 15:12
-
Wait so are you saying some drive does not have the ESP as in I cannot just add Grub to the drive I need a drive with an ESP built in to be able to add the Grub is that correct??? – Rodany Antoine May 20 '22 at 21:35
-
If only using a drive with one system, external or internal you only have to have one ESP and all systems will boot from that ESP. But if you have an external drive, you have to have an ESP with boot files to boot on another system, similar to the live installer. See this on Ubiquity installer and some work arounds: https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1396379 & https://askubuntu.com/questions/16988/how-do-i-install-ubuntu-to-a-usb-key-without-using-startup-disk-creator – oldfred May 21 '22 at 02:29
1 Answers
Installing Grub to an external hard drive that has Ubuntu installed
Boot into an Ubuntu live USB and connect the external hard drive.
List partitions of all devices:
lsblk
From the results of lsblk, identify the linux partition and also the efi partition of the external hard drive, i.e. /dev/sdXY1 and /dev/sdXY2 respectively. Replace XY1 and XY2 with your own partition names.
Special mount the linux partition:
sudo mount /dev/sdXY1 /mnt
Mount critical virtual filesystems:
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
chroot into the Linux partition you mounted:
sudo chroot /mnt
You are now in the external hard drive's linux filesystem.
Create the directory where grub would install its files:
mkdir -p /boot/efi
If it already exists, then skip to step 8.
Mount the efi partition from step 3:
mount /dev/sdXY2 /boot/efi
Install grub to the external hard drive:
grub-install /dev/sdX
Update grub:
update-grub
Find the UUID of the efi partition (aka 'vfat') and note it down:
blkid
or
ls -l /dev/disk/by-uuid
Now we need to tell fstab to mount that efi partition on boot:
cd /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab
Add the below two lines to fstab replacing xxxx-xxxx with the UUID from step 11:
#my modified fstab to mount external hard drive's esp
UUID=xxxx-xxxx /boot/efi vfat umask=0077 0 1
Make sure to comment out the fstab entry of the Windows esp so it doesn't conflict.
Exit the chroot:
exit
Reboot the PC:
sudo reboot
At this point when you reboot and choose your external device from the EFI boot manager, it will boot to grub.
To make Ubuntu automatically boot when you insert the external and Windows to automatically boot when the external is not inserted you would have to create a custom boot entry for Ubuntu to point to the efi on the external drive:
Creating a custom boot entry for Ubuntu to point to efi on the external HD
From Windows EasyUEFI can add or remove boot entries.
From Linux efibootmgr can add or remove boot entries.
Alternative #1 – using EasyUEFI
In Windows download EasyUEFI, install it and run.
Choose the EFI options manager
Choose create 'new entry' with + sign
Choose Linux or other OS and give it a name in the description box
Select the FAT32 EFI partition on the external drive that contains the grub bootloader
Choose browse
Navigate to
/efi/ubuntu/shimx64.efi
or/efi/ubuntu/grubx64
Save
Move it to the top of the boot entries list
Restart
Alternative #2 – using efibootmgr
- List boot menu entries:
efibootmgr
- Create a boot entry:
efibootmgr -c [-L label] [-d /dev/sdX]
e.g.: efibootmgr -c -L myubuntu -d /dev/sdX
This boot entry would automatically be the first entry.
/dev/sdX
is the external hard drive with the grub bootloader.
- You can now reboot and without your intervention Ubuntu would automatically boot when external hard drive is plugged in. When the external hard drive is not plugged in, the PC would skip our Ubuntu boot entry to the next entry which is probably Windows Boot Manager.

- 1,460