I regularly have the need to try things out on Linux. Sometimes a virtual machine won't cut it for me typically due to memory, disk and performance limitations. Moreover, a decent, up-to-date, bootable Linux environment is a great backup in case all of my other computers are broken, infected or stolen. That entails having the Linux installation on an external, USB-attached hard disk drive which can boot with relative ease on any UEFI-enabled PC (driver compatibility notwithstanding). Moreover, all the preparatory work has to be performed using a single-boot Windows computer without ending up having a dual boot system. It sounds tough. It is tough, but I'm writing this from my portable Ubuntu Linux installation running off a USB-attached SSD!

What you need

  • An empty external (USB) hard drive. I used a USB 3 drive enclosure with a cheap 256Gb SSD. For those of you worrying about performance, the USB 3.0 port is faster than the maximum transfer rate of any SSD I've seen to this date.
  • Ubuntu Linux bootable USB drive. Very easy to create using Rufus on Windows. I used a cheap, promotional flash drive. Reduce, reuse, recycle FTW.
  • Windows System Repair Disc (a bootable USB drive with Windows recovery tools which you can make yourself) or a Windows installation or rescue CD-ROM / DVD-ROM. I used another promotional flash drive.

Remember to take backups of all your critical files and folders before continuing. You are going to make changes to your computer. If it breaks don't cry, I warned you. Also test both your bootable media. Twice. You will need them both!


Having a dual- or multi-boot system isn't as straightforward as it used to be a decade ago. Nowadays, in the interest of security, performance and backwards compatibility, there are many semi-hidden options and features which can get in your way. Given enough experience and patience you can work around them. Below is a selection of problems that got me moderately stumped along the way.

Secure boot caveat

I have only tested these instructions with Secure Boot turned off. Even though Ubuntu does support Secure Boot (it comes with signed bootloaders) I have no idea if my method uses the signed bootloaders or not. I suggest turning off Secure Boot if possible.

FastBoot caveats

Many boards come with some sort of "fast boot" or "boot optimization" options. For example, my Intel NUC has an option called Fast Boot which won't let me choose an alternative boot device at startup. It also has an option to support Intel Rapid Start Technology which does get in the way of booting to multiple OS. I had to disable both.

It's worth noting that Windows 8 and 10 have an Fast Startup or Fast Boot feature. This feature takes some shortcuts when it comes to booting and also makes the NTFS filesystem remain in a dirty state, making it unwriteable from Linux. It's best to understand what it does and disable it if you plan on writing to your Windows drive from Linux.

USB host controller caveat

Some firmwares will present the USB host controller as UHCI (USB 1.1) at boot time. When Linux probes for an xHCI (USB 3) host controller during the boot process they will respond positively. At this time Linux loads the xHCI driver and the USB host controller resets itself.

However, your root filesystem is inside a device attached to this USB controller. Therefore the controller resetting means that Linux can no longer communicate with the USB-attached hard drive. Therefore the Linux boot will hang forever without any further indication as to what went wrong.

Most affected boards (including my Intel NUC) have an option to enable the xHCI host controller interface by default. Enabling the xHCI option in the BIOS fixes the hanging boot issue. If you are only using modern operating systems with USB 3 support (anything newer than and including Windows 8.1 and Ubuntu Linux 15.04) you can safely enable that option.

Installing Linux

Boot your computer from the Ubuntu Linux bootable USB drive. Remember that you may have to enter your computer's boot manager to do that (on my Intel NUC I have to press F10; on most other BIOS I've seen it's F9; consult your BIOS documentation).

Install Ubuntu Linux regularly. When it prompts you about the disk layout choose Something Else and partition your external HDD the way you want. I chose to create a modestly sized root partition (about 40Gb), a swap partition that's as big as the biggest RAM configuration I am going to be using this installation with plus one Gb (my computers max out at 16Gb so I made a 17Gb swap partition) and the rest of the disk went to a massive /home partition.

Caveat: I chose to use btrfs which – as I learned along the way – makes things a bit more complicated down the line. For your sanity's sake I recommend using ext4. This guide assumes the use of btrfs and will point out the caveats with this approach.

Fix Windows 10 boot

Unfortunately the Ubuntu Installer assumes that you want a dual booting configuration alongside Windows. Therefore it adds itself (actually, the bootloader it uses, GRUB2) to your computer's UEFI configuration. This causes two problems. For starters, the external HDD is not portable as you cannot boot with it on another computer.

Secondly, if you remove this external HDD your Windows won't boot. Bummer. We have to fix that.

  • Shut down your computer.
  • Disconnect the Ubuntu HDD
  • Boot from the Windows system repair disc USB drive (or a Windows installation or rescue CD-ROM / DVD-ROM).
  • Select Repair your computer.
  • Select the operating system and click Next.
  • Choose Command Prompt.
  • In the command prompt run
    sel disk 0
    list vol
  • Verify that the EFI partition is using the FAT32 file system. It will have a volume ID, let's say 99. Now we need to assign a drive letter to it. Back in the command prompt type:
    sel vol 99
    assign letter=z:
  • Now we need to fix the boot record. Again in the command prompt type:
    cd EFI/Microsoft/Boot
    bootrec /FixBoot
  • Finally, we need to re-create the BCD store which tells the Microsoft boot loader where to find Windows so it can boot it. From our trusted command prompt:
    ren BCD BCD.old
    bcdboot c:\Windows /l en-us /s z: All
  • If this didn't work try
    ren BCD BCD.old
    bootrec /RebuildBcd

At this point exit the command prompt and shut down your computer.

Create an ESP on the Ubuntu HDD

A hard drive is not bootable with UEFI unless it has an ESP (EFI System Partition). An ESP is simply a FAT32 partition with a special flag that tells the EFI BIOS to look inside it for boot information. We have to create one on your hard drive.

  • Plug in your external HDD and the Ubuntu Linux bootable USB stick.
  • Boot with the Ubuntu Linux bootable USB stick using the option to try Ubuntu before installing.
  • Open a Terminal (CTRL-ALT-T)
  • Run sudo fdisk -l to get a list of partitions.
  • Identify from them the drive that has the Linux partitions, in my case /dev/sdb. I'll call it /dev/sdX from now on.
  • Also identify the partition that contains the root filesystem. I will call it /dev/sdXY from now on.
  • Launch GParted from the Terminal:
    sudo gparted /dev/sdX
    Why not just click on GParted on your desktop? Well, I kept receiving errors about the Ubuntu Linux bootable USB stick because it was already in use. Of course it is, I am using it to run the computer off it, duh!
  • Resize the first partition on disk to have another 200 Mb of free space after it.
  • Create a new partition on the free space, changing the file system to fat32.
  • Apply operations. You need to do that now for the next step to be possible.
  • Right click the new partition.
  • Click on Manage Flags.
  • Set the boot and esp flags. This is what makes the partition "special" to the EFI BIOS.
  • One more thing! Note down the the partition that contains the ESP filesystem. I will call it /dev/sdXZ from now on.

Make sure the Ubuntu installation on the external HDD can see the ESP

The new ESP on the external drive must be visible by the Ubuntu installation in the HDD. Otherwise GRUB2, the Linux bootloader, won't be able to update itself, making your system unbootable after the next kernel update at the latest.

  • Launch GParted from the Terminal, as we saw above:
    sudo gparted /dev/sdX
  • Double click the partition with your Linux root (/) filesystem on the external HDD
  • Note down the UUID, e.g. 01234567-89ab-cdef-0123-4567890abcde
  • Double click the new FAT32 partition and note down the UUID, e.g. 0123-ABCD
  • Close GParted
  • Open a Terminal

The process is different depending on the format of your root partition on the external hard disk.

If you DID NOT use btrfs (e.g. you used ext4)

sudo umount /media/ubuntu/01234567-89ab-cdef-0123-4567890abcde 
sudo mount /dev/sdXY /mnt

If you DID use btrfs

If you DID use btrfs, you made your life complicated. We need to mount the btrfs subvolume containing the root partition instead of the entire partition. Otherwise you'll never be able to install GRUB and you'll probably lose an entire day, like me.

btrfs subvolume list /media/ubuntu/01234567-89ab-cdef-0123-4567890abcde

This will give you a line with a numeric ID. Let's say 123. Note it down.

umount /media/ubuntu/01234567-89ab-cdef-0123-4567890abcde
mount /dev/sdXY -o subvolid=123 /mnt

The rest of the instructions are common, no matter if used btrfs, ext4 or something else

  • sudo nano /mnt/etc/fstab
  • There is a line with /boot/efi already in this file. Comment it by placing a # in front of it.
  • Add the following line:
    UUID=0123-ABCD /boot/efi vfat defaults 0 1

Install GRUB2 on the external drive's EFI System Partition

Right now our external drive has an empty ESP. We need to put a bootloader in it to make it actually, well, bootable.

First caveat: all the instructions you find on-line assume you are using a dual boot system with Windows or macOS. When you have an external drive it is critical that you use the --removable option in the last step. This installs the EFI bootloader under the special "fallback path" EFI\Boot\bootx64.efi in the ESP. Normally this not supposed to be used for permanently installed Operating Systems. It's the mechanism used by EFI BIOS to boot arbitrary external media. Technically, that's exactly what our external hard drive is: arbitrary external media!

Second caveat: installing the bootloader is only possible from inside the Linux installation we want to boot. However, we need the bootloader to boot that installation, leading to a Catch-22 issue. The solution is to run the bootloader installation through a chroot jail. The actual caveat that got me stumped for a day comes from the fact that I am using btrfs (because it's so much better for SSDs!). btrfs has subvolumes. If you mount the entire partition instead of a subvolume the grub-install script can't figure out the mapping between paths and devices, therefore failing to install itself on the ESP, returning the cryptic error

/usr/sbin/grub-probe: error: cannot find a device for / (is /dev mounted?).

The error is misleading! /dev is mounted if you follow my instructions below. The actual problem, as I understand it, is that there is a discrepancy between the mounted device and the path to the chroot root. That's why I had you mount only the subvolume containing the root filesystem in the steps above. If you were not paying attention, you are not following the instructions step-by-step, you rebooted before this step or just came here directly looking for a solution to your problem about GRUB not installing look above for instructions on mounting the correct btrfs subvolume.

  • We need to prepare the chroot environment. The ESP must be mounted in the correct place and we have to bind system mount point for some special trees (most notably /dev). Moreover, we will copy the resolv.conf file to let the chroot environment have network access should it need it.
    mount /dev/sdXZ /mnt/boot/efi
    for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i; done
    cp /etc/resolv.conf /mnt/etc/
    modprobe efivars
  • Finally we enter the chroot environment and install Grub in a way suitable for a removable device (see the first caveat above).
    sudo chroot /mnt
    grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdX

Now your external HDD is bootable. Reboot your computer, select it from the boot media selection of your UEFI BIOS and you're done!

201 thoughts on “Making a portable full installation of Ubuntu on a USB HDD”

  1. Wednesday, 15 November 2017 13:39
    Hi. I would like to notice that in the 'Fix windows 10 boot' when recreating the BCD store. A '/f' flag is missing from the original instructions, and the RIGHT version should be:

    bcdboot c:\Windows /l en-us /s z: /f All

    Otherwise, very bad things happen... :*
  2. Sunday, 19 November 2017 01:14
    Wow! I just finished this procedure, and it works. It did take several hours for me to complete it because I and just getting started with Ubuntu Linux. One thing which took me a while to figure out was that I had to change directory to "/" before the "cp /etc/resolv.conf /mnt/etc/" would work. This was located in the second to last bullet point in the procedure. Question: now hard would it be to change to Linux Mint if I want to do that? Do I have to start all over at the beginning of the procedure? Many thanks for the detailed procedure! No way I would have done the installation in this manner without the excellent procedure.
    1. Wednesday, 22 November 2017 11:54
      Mint is not an official flavor of Ubuntu IIRC, meaning that you can't just apt-get install something and be done with it (as you'd do with Kubunty, Xubuntu, Mythbuntu and other official flavors). So in this case, yup, you'd need to start over.
  3. Sunday, 19 November 2017 01:30
    Oops: I didn't notice the last comment about the missing "/f" flag. Is this comment validated by N.K. Dionysopoulos? Can I fix it now, after already booting from my external ssd?
    1. Wednesday, 22 November 2017 12:00
      It's not a flag, it's a selector. It tells bcdboot which boot loader (formware) technology to use: BIOS (MBR) or UEFI. The default value is auto-detect. If you are running it on a UEFI-capable computer it will default to UEFI. I would NOT use /f All unless you have a valid reason to want to boot Windows using legacy boot. Since this guide talks about UEFI I think it's safe to assume you'd never want to do it. Well, if you have explicitly enabled legacy boot and your firmware doesn't fall back to UEFI if there's no MBR record then, yes, you will need to use /f All - which I believe is what happened to our anonymous friend above. For most other people, though, this would be an unnecessary step with potential complications.

      TL;DR: If it ain't broken don't fix it.
  4. Wednesday, 22 November 2017 10:22
    Hi Nicholas, GREAT job!... but I need a little help. I'm trying to follow your guide using my mac and installing ubuntu on my external HD. Do you think will be the same? Is your guide usefull for Apple's too? Thank you in advance.
    Best regards.

    1. Wednesday, 22 November 2017 12:08
      It's actually simpler with Macs since all you need to do is reset the PRAM after unplugging the external SSD. The Mac's firmware prioritizes booting macOS from the main partition of the primary disk. I would bet that you have a MacBook Pro / Air which means that macOS will prioritize booting from its internal SSD. Therefore you don't need to do the whole restore Windows bootloader dance. You still need to follow the instructions to reinstall the Linux bootloader in a way that makes it into a portable boot disk.

      That said, running Linux on a Mac is a pretty hectic experience since Apple won't release any drivers or specifications for its proprietary hardware implementations, of course. The least of my worries had been the keyboard. Using an external keyboard or mapping keys the hard ways had helped a lot. The major problem I had with it is that many built-in devices won't work. You may get iSight working if you have an old Mac. Forget about getting the SD card reader working. If you have a 15" with discrete graphics you're in for a world of pain (I have an old 2011 MacBook Pro with AMD discrete graphics that took serious boot parameter tinkering to get it booting and nope, discrete graphics won't work at all). The touchpad was recognized as a 2 button mouse - no multitouch. External touchpad was simply not working. Magic Mouse was recognized as a very non-magical 2 button mouse. It couldn've been worse.
  5. Friday, 24 November 2017 00:37
    I do have a problem: My system won't boot when I remove the external ssd. I get The message: GNU GRUB Version 2.02~beta3-4ubuntu7. This is followed by several more lines That begin with "Minimal BASH-like line editing is supported. ..." followed by "grub _". Apparently, I did something wrong. I am using a computer with Windows 10 installed. I did execute the line: "bcdboot c:\Windows /l en-us /s z: All" (it is possible that I entered /1 instead of /l after windows). I got a message that indicated the command didn't work - don't remember the wording. Then, I executed the "bootrec /RebuildBcd" command. It seemed to work; I got no message after I executed it. Then, I continued with the remaining instructions. My system works fine with Ubuntu, but will not boot to Windows 10. Can you suggest how I should fix this, please. Thanks, Jim Mc.
    1. Friday, 24 November 2017 10:17
      My only logical conclusion is that you accidentally missed something in the "Fix Windows 10 boot" section of this guide. It's the trickiest bit for getting this to work. It took me two days to figure out how to fix the same problem you had and that's how I fixed it. Then I started over and redid everything from scratch just to make sure that my guide is accurate (yup, it is). If, however, you miss any of the steps, even those which look inconsequential (like changing to the ESP directory before running bcdboot) can throw the entire process out of whack.

      So, my best advice is to print a hardcopy of this guide, or open it on a tablet / phone / whatever, and retry the Fix Windows 10 Boot section's instructions very carefully, without skipping anything. I know it sucks and it's slow. Sorry :(
  6. Monday, 04 December 2017 06:59
    I finally got back to this, and it works. However, to boot to Windows with the HDD removed, it is necessary to go into setup and change the first boot device to "windows Boot Manager", save changes, and exit; otherwise it hangs. I thought it would automatically skip Ubuntu and boot into Windows, but it doesn't. Thanks for the procedure and the help. Jim
    1. Monday, 04 December 2017 11:57
      Boot into your UEFI setup (what we used to call "BIOS" in the olden days) and change the boot order. Set Windows first.
  7. Tuesday, 05 December 2017 00:23
    With "Windows boot manager" as the first boot device, it always boots into windows, and I don't have an option to boot into Ubuntu without going into setup and changing the first boot device to Ubuntu. Not a big issue, just a small annoyance that I can deal with. If Ubuntu is set to boot first, I do have the option to choose Windows, but if I then disconnect the SSD, I have to go into setup and change the first boot device to windows. It would be a tad more convenient if it would just skip ubuntu when the SSD is disconnected, or give the option to choose Windows or Ubuntu when the first boot device is set to Windows. I'm not complaining, just making a fine point.
  8. Wednesday, 13 December 2017 18:02
    I've seen other HOWTOs that suggest an alternate process, which *sounds* simpler: (1) set the BIOS boot sequence to boot from a USB device, (2) shut down compuyer and disconnect internal hard disk(s), (3) boot Ubuntu from USB flash drive, (4) install Ubunti form flash drive to portable hard disk. (Since the only i8nstalled or available hard disk is the portable one, it will be installed as single boot without altering the disconnected internal drive.) Any comments./comparisons on this, or any additional steps this would require to insure compatibility with UEFI? I am carrying out the install on an older BIOS computer, but want to be able to use the portable hard disk to boot UEFI machines.
    1. Wednesday, 13 December 2017 21:16
      First of all you need to disconnect the internal hard drive which may not always be feasible or convenient. It’s been a decade since I last run a midi tower with a side panel missing and don’t get me started on my Slimbook and its abundance of screws.

      Secondly, most computers will freak out as soon as you unplug the USB HDD because the only and default boot disk disappeared.

      Thirdly and MOST important: what you end up with IS NOT a portable hard drive! It will only boot on the computer you installed it on and only if you don’t mess with the UEFI boot order. In other words you’ll still have to press F9 to choose which OS to boot on the original computer and your HDD cannot be used anywhere.

      I don’t know what the other people claim, but it doesn’t look like they tried their own instructions. I did and I was disappointed. So I spent two days, found instructions that work, wrote them down, formatted my HDD again, tried them again and only then did I hit publish.

      Basically, if you see something written on this blog I have tried and use it myself. I don’t do useless brain fart dumps for page views. That’s why my blog posts are so far in between :)

  9. Thursday, 28 December 2017 04:12
    Thank you for these instructions. I use W8 on my notebook but having an Ubuntu installation available on my notebook would come in handy for me because I'll be away from my desktop with Ubuntu for over a month soon. I don't want to make any changes to my notebook's HDD with W8 installation, so I thought running Ubuntu from an external drive would be the best.
    Before I start (well, I still haven't got any SSD yet, so I can't really start yet), I would like to confirm one thing. Does it mean that if I follow these instructions, I can create an installation of Ubuntu and make it bootable on some PC, and then when it's done take the SSD and use it with a different PC if I plug it in and change the booting priority?
    If it's possible I'd rather try to make the external SSD Ubuntu installation on my old W7 notebook so that it wouldn't matter that much if something got screwed up during the part where you have to fix Windows booting. But I'd like to use it with my regular W8 notebook when it's done.
    1. Thursday, 28 December 2017 08:32
      Hello Jan,

      Yes, you understand correctly. You can create the bootable drive on any computer and have it boot on any other computer just fine. Modern Linux is very smart about automatically detecting hardware and loading the appropriate drivers. I've tested that by booting my portable Ubuntu installation off a MacBook Pro when I had to boot the Intel NUC into Windows but still needed to use my Ubuntu installation at the same time :)
  10. Saturday, 30 December 2017 15:57
    Can we unplug the internal disk drive that contains windows to avoid the fix part?
    1. Saturday, 06 January 2018 18:09
      Maybe, but I wouldn't count on it. Installing an operating system may change the default EFI boot entry in the system. Part of the solution addressed that issue.
  11. Sunday, 31 December 2017 17:16
    Thank you for these instructions. However im running into a boot issue. when the dual boot screen appears i select Ubuntu and then it seems as though it want to load the OS but then i get a screen which is black and white and list some boot details (similar to below). any thoughts? also, the hardware is a surface pro 3. thanks

    [ 1.65621] 18042: cant read CTR while initializing 18042
    /dev/sdb1: clean, 187936/2437776 files, 1117662/971276 blocks
    [FAILED] failed to mount /boot/efi.
    See 'systemctl status boot-efi.mount' for details

    1. Saturday, 06 January 2018 18:12
      The first line is not an error, see https://unix.stackexchange.com/questions/379834/linux-throws-error-cant-read-ctr-while-intializing-i8042

      The second line means that Ubuntu can't mount the EFI partition. At this point it should be throwing you to a shell. As told, run systemctl status boot-efi.mount to see why the mount failed. This should give you more clues as to what's going on. 80% of the time spent on the computer doing something new is troubleshooting - but that's we get to learn something new, right? ;)
  12. Tuesday, 16 January 2018 02:48
    Hey I've been trying to follow this guide but I can't seem to get past the fix windows 10 boot part! I keep getting a "access denied" message whenever I try to fixboot. I can still boot into windows with the external drive unplugged, but I can't boot into the drive on any other computer. I don't think I misfollowed the guide anywhere but just in case I've uploaded a picture of my command prompt: https://m.imgur.com/MxNT1Id. Do you know of any solution? I'm on currently on a Lenovo flex 3 laptop and I'm pretty positive the ESP is the EFI partition.
    1. Thursday, 18 January 2018 13:12
      It looks like you're mounting the wrong partition. This seems to be the Lenovo Recovery System EFI System Partition if I were to make an educated guess based on its name (LRS_ESP). Since it's part of the system recovery I bet it's immutable. Look at volume 2. It's FAT32 which is what an EFI partition should be. It's small (260MB) which is also what an EFI partition should be. It's also called SYSTEM_DRV which seems to be consistent with an EFI (system) partition.
  13. Friday, 19 January 2018 04:35
    Thanks for the reply! Unfortunately I'm getting the same access is denied error for that volume as well :(. I'm on a Lenovo Flex 3 laptop, and I'm starting to think this isn't possible to do on my hardware.
  14. Thursday, 25 January 2018 01:38
    Hello. I followed all of your steps, but when I boot into Ubuntu, it shows "file /boot not found." Can you please help me? I looked up steps and it said I needed to include --boot-directory?
    1. Thursday, 25 January 2018 07:35
      Are you using BTRFS instead of, say, EXT4? In this case you need to list the subvolumes and mount them. If your boot directory is a separate subvolume you have to mount it too. BTRFS always has subvolumes, even if you use one partition per volume. This cost me a day and some of my sanity as I explicitly say in the tutorial.

      Generally, remember to mount your /boot volume before mounting /boot/efi, in its turn happening before you enter a chroot environment to install GRUB to the external drive. If you mess it up GRUB will install its configuration files on the main volume (filesystem root, where the /boot mount point lives) which, of course, won't work properly since at boot time Linux will be mounting the boot volume to /boot, thus hiding any files in there.

      Also check your /etc/fstab file. If your /boot directory is on a different volume than your main (filesystem root) volume you need to have an entry there. Check that the UUID of the entry matches the reality of the partition table of your removable drive. The same applies for the EFI System Partition volume which also needs an fstab entry to mount point /boot/efi. I think that this is most likely what happened to you since you got a message about the /boot partition not being found by our friend GRUB.

      Only after doing all of that should you follow the last two steps of this tutorial. Then GRUB will be seeing all the partitions, mounted to our chroot environment, and the fstab will tell it how to find those partitions at boot time. The options we pass to GRUB will install an EFI boot loader on the external drive and that's all there is to it.
      1. Thursday, 25 January 2018 23:30
        Thank you! That fixed my problem! The /etc/fstab file was on the wrong drive. I fixed it and now it works!
        1. Friday, 26 January 2018 12:03
          You're welcome! I am glad I could help :)
          1. Saturday, 27 January 2018 06:31
            Also, yes. It does work on Secure Boot.
            Also, does this work on mac? I have windows, and is it possible to do cross-platform
            1. Saturday, 27 January 2018 10:59
              It should work on a Mac. I have only tried this on a 2011 MacBook Pro without issues. If anything, it was easier than getting it to work on Intel NUC.
  15. Monday, 29 January 2018 03:43
    Thank you so much for the work you've put into this. I've had the same issue as Eric with the Windows fixboot 'access denied' error, and I'm definitely using the correct EFI partition (its the only fat32 partition of 100MB). But I'll deal with it by just reinstalling Windows 10 from scratch - thankfully I made a system image backup before starting this process.

    My (newbie) question is simpler: when preparing the chroot environment, how do I get from the ">" prompt, back to the normal terminal prompt? (Screenshot https://goo.gl/virUVq). Typing 'exit' didn't work. Thanks!
    1. Tuesday, 30 January 2018 09:58
      Check all your FAT32 partitions. Also note that they may not be in the first volume (physical device)! Many computers come with separate devices. Sometimes you have two separate devices even though you have installed only one hard disk if that hard disk is hybrid (an HDD and an SSD in one). While Windows sees it as one big drive, this is just a logical grouping; there are two physical devices and that's what matters when we try to get boot working ;)

      Regarding the chroot environment, pressing CTRL-D or typing exit should work. Please note that whenever you use sudo you get into a child shell so you have to exit this first. That is to say, if you chroot and then sudo you need to use exit twice to get back to the original shell you started from.
  16. Monday, 29 January 2018 05:49
    Hi there!
    Great tutorial.
    I want and will try this solution with a HDD plugged on Windows 10 laptop.
    My only doubt is that if when I install Ubuntu on the external HDD will Grub replace Windows 10 default bootloader/boot manager? Or in other words, will I always have the Grub menu instead of Windows 10 default bootloader/boot manager even when the HDD is not connected by usb to the laptop?
    My intention is not to have the Grub menu, that is, if I boot from the laptop disk, automatically boot Windows 10. And if I boot from the external HDD, automatically boot Ubuntu!
    Is that possible?
    At best, I would not mind that Grub menu only showing if booting from the external HDD, where Ubuntu is installed.
    Best regards,
    José Pedro
    1. Tuesday, 30 January 2018 10:01
      When you install Ubuntu it does replace Windows boot manager. That's why we have a tutorial section on recovering the Windows boot manager :)

      If you follow my instructions your laptop's internal drive will only have your Windows boot manager and only boot on Windows. The external HDD will have a special UEFI executable for GRUB2. This lets you plug it into any UEFI-capable computer (pretty much everything built after 2010 or thereabouts) and boot it - note that you may have to enter the boot selection menu if you haven't made boot from USB a higher priority item than boot from internal drive in the UEFI configuration (what we used to call "BIOS" back in the day).
      1. Sunday, 04 February 2018 17:03
        Thanks for your answer.

        I'de also like to ask your opinion about I read in another article/tutorial, where the instructions are to install Ubuntu (from the live USB) opening the Terminal and run the following command:

        ubiquity --no-bootloader

        With this the author says the installation would not replace the Windows default bootloader.
        Is this accurate?

        Then the instructions (after Ubuntu is installed) are to boot from the live USB and use the GRUB console to look for the new installation, specifically look for the /boot/grub directory:

        grub> ls (hd2,gpt2)/boot/grub
        unicode.pf2 ...

        Then set this as the root for further commands:

        grub> set root=(hd2,gpt2)

        Then find out the UUID of the drive:

        grub> ls -l (hd2,gpt2)
                Partition hd2,gpt2: Filesystem type ext* 〈...snip...〉 UUID e86c20b9-83e1-447d-a3be-d1ddaad6c4c6 - Partition start at [...]

        After that tell GRUB where Linux is:

        grub> linux /boot/vmlinuz〈...tab here!...〉.efi.signed root=UUID=〈the UUID from above〉

        Finally set the initrd (initial RAM disk) and boot:

        grub> initrd /boot/initrd〈...tab here!...〉

        grub> boot

        What do you think about this solution?
        1. Sunday, 04 February 2018 18:40
          Running ubiquity (the Live CD installer) like that will indeed NOT install GRUB at all. Anywhere. The rest of the instructions, however, don't make your external HDD bootable. If you read the original article over at Medium (side note: ALWAYS attribute sources, don't plagiarize) you'll see that his goal was to boot to Linux once and then change his EFI partition type, making an HDD that's only ever bootable on a Mac. With my instructions your HDD will be bootable on any computer with EFI and USB boot enabled, including but not limited to Macs (so far I've tried on a late-2011 MacBook Pro 15", late-2012 Mac Mini and an early-2015 MacBook Pro 13").

          To be precise, the rest of the instructions you posted from that article would have to be carried out every single time you want to boot to Linux. Yes, every single time you will have to insert the Live CD / Live USB, display its GRUB menu, drop back to the GRUB command prompt, mess with UUIDs and hopefully boot to Linux. This is the exact opposite to user-friendly. Also, it's highly unnecessary. Instead of these instructions just carry out my instructions from "Create an ESP on the Ubuntu HDD" onwards.

          Disclaimer: Follow this at your own risk. I have not tested this method. Your mileage may vary. If it breaks you get to keep both pieces ;)
  17. Monday, 05 February 2018 03:23
    Sorry for not having attributed the source of the information, but I'm not used to these things.

    I'll follow your instruction as soon has the external HDD arrives.

    My intention was to install Ubuntu on the external HDD, and whenever I wanted to boot to Ubuntu (always from the same PC) I'd only have to connect the HDD (in the UEFI/BIOS settings booting from the external HDD would have priority).
    I thought the process would be simpler, not that your instructions are complicated.

    Thank for the quick replies! :)
  18. Monday, 05 February 2018 10:20
    boot-repair could save you all the steps done with grub. All you need is the fat32 partition and fireup boot-repair, the rest explains the UI at the Advanced tap.
    1. Monday, 05 February 2018 11:51
      I had already tried that, unsuccessfully. That's why I went into the trouble of doing things manually and write it up. You can of course try your luck with boot-repair and if it fails just pout instead of using the free instructions someone posted on the Internet. But please don't come and shitpost on the comments. Nobody likes an arrogant know-it-all asshat. kthxbye
  19. Thursday, 08 February 2018 23:33
    Hi when I run:
    for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i; done
    I get:
    mount: mount point /mnt//dev does not exist
    mount: mount point /mnt//dev/pts does not exist
    mount: mount point /mnt//proc does not exist
    mount: mount point /mnt//sys does not exist
    Which makes me think I've done something wrong
    Also when I run:
    sudo chroot /mnt
    I get:
    chroot: failed to run command ‘/bin/bash’: No such file or directory
    Which makes me think I've made a mistake elsewhere in following the tutorial, any ideas on what I'm doing wrong?

    1. Saturday, 10 February 2018 13:10
      Follow all my instructions from "Make sure the Ubuntu installation on the external HDD can see the ESP" onwards. Most likely you either forgot to mount the external drive under /mnt or the drive is formatted with the BTRFS file system for which I have added some very important warnings.
  20. Wednesday, 14 February 2018 05:30
    What if I unplug my widows drive
    1. Wednesday, 14 February 2018 10:34
      Already answered in the comments.
  21. Wednesday, 14 February 2018 10:28
    I followed all your steps. When I run last command
    grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdb

    I get this error:

    grub-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesnn't exist. Please specify --target or --directory

    Filesystem is formated as ext4

    Any ideas?
    1. Wednesday, 14 February 2018 10:35
      Let me Google that for you ;) https://askubuntu.com/questions/763472/what-can-i-do-to-fix-this-error-on-grub-efi/763746
      1. Wednesday, 14 February 2018 11:48
        Thanks for immediate reply,

        so I changed command to

        grub-install -d /usr/lib/grub/i386-pc --efi-directory=/boot/efi/ --removable -dev/sdb

        and output was:

        Installig for i386-pc platform.
        grub-install: error: failed to get canonical path of `/dev/sdb3'.

        by the way: sdb1 is EFI, sdb2 SWAP, sdb3 ext4 linux root, sdb4 ext4 - data

        Is it trying to install grub on my linux partition instead of EFI?

        1. Wednesday, 14 February 2018 12:16
          I suppose you meant --removable /dev/sdb over there :) First make sure that you are running this from inside the chroot jail in /mnt. The error you get means that GRUB can't find an /etc/fstab entry for the /dev/sdb3 partition, therefore it has no idea it's the root partition. You can also try adding --force to the GRUB installation command line to force the installation but if you're not inside the chroot jail you won't get a bootable drive.
          1. Wednesday, 14 February 2018 13:49
            Before, I did run the command:
            sudo chroot /mnt
            and line changed from
            root@ubuntu:/# (and changed from green to white)

            If that's what u'r asking. I did also all the steps above - except fix windows 10boot. My emmc with windows is dead - that's why I'm installing Ubuntu to external HDD. So the original EFI partition on emmc is destroyed. And I don't care about running windows. Just Ubuntu from external.
          2. Thursday, 15 February 2018 10:46
            found the mistake - missed one step, my bad - sorry for bothering with that.
            (missed sudo nano /mnt/etc/fstab)

            so, after including that, I run the installation with following amendments:

            had to run following commands as sudo (I get permission error if I wouldn't):
            sudo mount /dev/sda1 /mnt/boot/efi
            sudo cp /etc/resolv.conf /mnt/etc/

            the instalation of grub in last step finished this time with following remarks

            grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
            grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blockllist. However, blocklists are UNRELIABLE and their use is discouraged..
            grub-install: error: will not proceed with blocklist

            After reboot I still can't see the external HDD to boot from.

            I tried this

            to fix that, grub installed without errors - but still can't boot. (etc can't see HDD when booting)

            Any help here would be very appreciated - I'm fighting with this over a week. This is second approach to this. First I tried was (because that exactly computer I'm working with)

            but that's for internal emmc not for external HDD, so I ended here.

  22. Friday, 16 February 2018 04:27
    Hi there.

    I finally got the opportunity to install Ubuntu on a 160 GB HDD, following the steps of your tutorial.
    At the end of the process I get Ubuntu boot when I select to boot from the external HDD, but the only problem I have is that before the Grub Menu appears, the following error messages appear:

    error: file '/boot/' not found.
    error: no such device: /.disk/info.
    error: no such device: /.disk/mini-info.

    Can you tell what is causing this error?
    Is there any solution?

    Best regards.
    1. Sunday, 18 February 2018 11:17
      I never had this error myself. So all I would do is look it up on Google.
    2. Wednesday, 16 September 2020 06:07

      I have encountered this issue too. In my case, I forgot to turn off security boot in BIOS menu. Besides, I add an additional setting at step Install GRUB2 to turn off uefi secure boot as follows:

      grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable --no-uefi-secure-boot /dev/sdX

      That fixes the issue.


      I followed tutorial to create a portable Ubuntu successfully except for this tiny annoying message at startup. I guess grub-install enables uefi security boot by default in my case. However my two laptops (MSI GL62 6QD and thinkpad x1e) do not support well for Ubuntu security boot, I guess. That causes the error message.

      After I reinstall grub with --no-uefi-secure-boot specified, the error message disappears if I turn of security boot in BIOS.

      Thank you very much for your great tutorial and I hope others encountered this issue may find a solution.


  23. Sunday, 18 February 2018 00:41
    Able to see uefi entry Ubuntu , boot into gnu grub, and doesn't load Ubuntu system.. not able to proceed further, any help
    1. Sunday, 18 February 2018 11:19
      Obviously you didn't follow all of the steps. Retry and make sure you don't forget to do anything. Do NOT take creative license in interpreting the instructions in the blog post, do NOT skip instructions you think don't apply to you. If there was something you could omit it wouldn't have been included in the first place. And please make sure that you are careful with the disk and partition names.
  24. Sunday, 18 February 2018 18:50
    can u help me in my present condition, i followed the steps it went on smooth until this.. "mount /dev/sdXZ /mnt/boot/efi" it returned no such folder, so i manually created /boo/efi folder.. after that it went smoothly and completed installing grub. so now i am able to see two different uefi entires one for windows and one for ubuntu , windows is working as expected which i am very happy about, but if i choose uefi ubuntu it goes into (grub >) gnu grub prompt, i tried some commands there, 'boot' resulted in load kernal first, i also tried set root and set prefix commands.. no luck any suggestions to point the boot files from grub and boot to it.. NOTE: i have separate partitions for 'swap', 'efi', '/boot', '/'. everything formatted in ext4 primary except the efi which defaults to fat32 and thanks for the tutorial.. a video tutorial will be much helpful any plans on that?
    1. Monday, 19 February 2018 09:40
      The problem is that /boot/efi is a mount point where you are supposed to mount the EFI partition per the instructions. You didn't do that because you skipped over an entire section. Then you created a folder by that name which is of course not visible by the UEFI firmware during pre-boot because it's a folder inside an Ext4 partition, not a FAT32 partition itself.

      As I have written in a few comments above: do not skip any of the instructions, do not change their order. There is a reason why I've written all of that in a specific order :)

      So, the only thing you can do is start the process from scratch and this time be careful. If necessary, print out the instructions and use a highlighter pen to keep track of what you've done so far.
      1. Monday, 19 February 2018 22:23
        thanks for replying, i tried some tools like supergrub2 and boot-repair, now i am able to boot and use it, maynot be as intended or depicted by this tutorial, but atleast i will be able backup if wanted and try ur procedure again to see where i went wrong.. thanks again
  25. Thursday, 01 March 2018 03:50
    I found the simplest way to install linux to a portable disk is to shut down the pc, disconnect all hard drives, boot from the usb, plug in the portable hdd, and go!
    1. Thursday, 01 March 2018 10:04
      No, you are wrong. Your solution only applies to machines you can tear apart and have non-soldered storage. It also does not make a portable installation. If you plug in that drive on another computer or if you plug in a different mix of drives on your machine it will fail to boot. It's most definitely not portable. I will tell you everything that is wrong with what you wrote.

      For starters, you are missing the point that these instructions will be carried out primarily by people who have laptops which are a. under warranty or provided by an employer i.e. you can't put a screwdriver on them; or b. use proprietary screws or glue; or c. have soldered-on storage or otherwise require taking apart the entire machine to reach the drive's cable (or a combination of the above). In my case it was building the Ubuntu image on an Intel NUC. Not only it's a pain in the rear opening up the tiny computer and removing the m2 drive, its capricious EFI also give you lots of issues when you change the attached drives. So, no, removing the drive is not the universally "simplest" solution.

      But let's say this is not an issue. The biggest problem is that you are NOT doing a portable installation. The regular Ubuntu installation will result in an EFI System Partition which only works for the specific computer and the specific device name your drive got during boot. Please read up on how grub2-install works and why --removable is all important. Right now your drive won't boot on another computer, making it non-portable.

      I will give you an F-. Next time think why someone wrote a detailed article if there in an obvious "simplest" solution. Maybe the answer is that your "simplest" solution is actually broken in subtle but very important ways?
  26. Sunday, 04 March 2018 23:36
    Is it possible to use an efi bootloader manager like clover or rEFInd instead of using your solution?

    I tried to follow your tutorial but somehow i made a mistake and couldn't make it work..
    1. Monday, 05 March 2018 09:46
      I guess you can always try? Don't ask me how, though. The method I found to be working and the exact steps to reproduce it is documented in the article you are commenting on.
  27. Friday, 06 April 2018 21:55
    I'm not sure how else to say this except that "you are a f'ing SUPERHERO". I'd love to support any upcoming projects you might have in the works. Email me whenever you see this. For anyone interested in this tutorial, please note that I was very hesitant myself until noticing that the dev made a point to say that anything posted had been tried himself and that's why his tutorials are so few and far between. Not to mention that everywhere else on the net remarks that this is simply impossible to accomplish. Bullshit! This tutorial is unbelievable in its accuracy and effectiveness! God Bless You my friend. Thank you ever do much!! You are the king in my book! Have a great day!

    I should mention that the only part that needs updating is that when arriving at the line where, in windows recovery steps, you have to do the command with /fixboot as the switch, the command fails with "Access denied". The workaround is to do the following :

    Z:\>format Z: /fs:FAT32

    (erase the entire EFI partition which was assigned in a previous step to the arbitrary Z:, so in keeping with the example variables...)

    Then, simply,

    Z:\>bcdboot C:\windows /s V: /f UEFI

    (This replaces the Just initialized partition with a rebuilt data by the Microsoft command line tools).

    That is all, then continue with rest of steps as posted, word for word.

    Oh. I almost forgot...I was setting up external bootable for my Surface Book 2 with the target being Kali Linux 2018.1, so the only other minor detail was that at the very end, when installing the grub loader to the external IS drive using live Linux off of USB stick, in the paths, I had to replace
    >umount /dev/ubuntu/... With, simply,
    >umount /dev/root/...

    That's really it!!

    Again, dev, you are a rockstar! This is amazing!! I can't believe it's working without issue whatsoever!!
    1. Wednesday, 11 April 2018 10:07
      Thank you for your kind words :) Yes, everything I post here is meticulously tested by yours truly. My blog is typically three parts field notes and one part prose. I am for quality, not quantity.

      Please do let me know how Kali works on your Surface Book. I have the older Surface Book and I was thinking of creating a Kali USB stick. My only hesitation has been that some stuff doesn't work even in Ubuntu (obviously the touchscreen since the driver not in the official, therefore signed Kernel yet; sound was dead; built in keyboard and touchpad only started working in 17.04 etc). Also tell me which external Ethernet card you're using because I've yet to find one which will reliably work in promiscuous mode.

      Now, regarding the fixboot switch, it requires Administrator privileges. I have a Win10 bootable stick from Anniversary Update. It is possible that MS changed something in between but I am incredulous. After all, how do you fix a bricked Windows installation if you are not allowed to fix the boot?! Then again, I was writing this tutorial based on what I was doing on a mid-2013 Intel NUC with Windows 10 Anniversary Update. It's possible that Surface Book applies more strict controls over what you can do. I'm pretty sure there were UEFI options to that end.
  28. Saturday, 21 April 2018 04:04

    For some reason, after about one month, I can no longer write files to the operating system?
    1. Saturday, 21 April 2018 09:30
      Your filesystem may have a problem and gets mounted read only. Why don't you start in single user / repair mode and do a fsck to see where's the problem? This is standard Linux admin :)
      1. Sunday, 22 April 2018 23:08

        It says that "Inodes that were part of a corrupted orphan list were found."

        After I fsck, the system is still read-only.
        1. Sunday, 22 April 2018 23:50
          With the power vested to me by Google I present thee a thread relevant to your question https://forums.opensuse.org/showthread.php/467196-Error-corrupted-orphan-linked-list

          It only took me a few hours until I had the time to do that 2-minute search you could have done yourself. 

          Hint: if you see something you don’t understand on your screen search for it online. If you expect other people to do your homework for free you’re setting yourself up for some major disappointment in the long run. 
  29. Sunday, 27 May 2018 06:01
    For the step Fix Windows Boot, I use a software Disk Genius in Windows, delete the Ubuntu folder in Windows ESP partition, it works.
  30. Tuesday, 29 May 2018 12:42
    Almost all the way through... But, when I try to mount sdxz as sudo mount /dev/sdXZ/ /mnt/boot/efi , an error pops up: mount: /mnt/boot/efi: mount point does not exist.

    I changed the difectory to mnt and saw it was empty. Any suggestions?
    1. Tuesday, 29 May 2018 12:53
      The instructions right above that bit tell you how to mount your external disk into /mnt. You either didn't do that or you got an error and you missed it.
  31. Thursday, 31 May 2018 20:50
    Thanks, it works, eventhough I didn't fix windows 10  boot. 
  32. Friday, 15 June 2018 07:43
    Thanks everybody.  I had an old boot of debian I think (It's been a while since I loaded it), and it was just cloned to other drives using gparted, and later, a copy of partition guru, then power iso.  It was so versatile I had a few freelance techs using it to run cleanup\recovery opps whenever we needed to.  We loaded that, and a WinPE rescue disk onto several drives, allowing us to clean up most problems just before they hit the "sorry, it's dead" stage.  Back then, we had a single tower with a P4 and a few gigs of ram.  A 1gb swap area was enough to be very fast by comparison to the winpe.  We had upgraded that one tower for a main software setup several times, as it ran ubuntu, winpe, and a full version of windows server 2012, which we used for running everything.  6 weeks ago, I took some time off, to handle family issues and school.  One of the newbees tossed the machine on the garbage heap.  So, I've decided that we're all going to carry a drive with some system tools, and we'll carry one of the working laptops for onsite work, rather than attempting to hook everything to a windows server running virtualboxes with winpe.  We'll upgrade that machine again, but it will be for the most extreme cases.  Otherwise, working laptops with an i5 or better suffice.
    Your posts here were a great refresher, and an update in the use of EFI, thank you.  ALL of you.  And to add my two cents...
    SSD's and usb drives are not meant as permanent storage.  They are less permanent than magnetic data at the moment, but are rapidly closing the gap.  They are meant for storage with fewer changes, but new drivers and controllers are allowing them to spread the workload out, stretching their lifespan.  They don't succumb to as many bad blocks, but sectors will burn out, and you may have to repair an install once in a while.  For DATA, cloud and HDD RAID provide speed with longevity.  Cloud as a service lets somebody else worry about the maintenance, while you have constant access.
    In corporate, it's a balancing act.  At home, I use an HDD for my data, and an ssd for system.
    1. Friday, 15 June 2018 13:59
      SSDs are definitely meant for permanent storage the last 8 or so years. 15 years ago, no they were not. MLC flash storage suffered from electron bleed which could cause bit flips if the device was not powered on for over 1 to 3 years. Technology has progressed ever since and now it's just as reliable as spinning disks as evidenced by its use in the data center and every single portable device save for cheap, crappy laptops.

      Now, USB sticks are a different issue altogether. The flash storage used there is not even near the level of a modern SSD and yes, they are neither as fast nor as reliable. That's why I would NEVER use them for anything more serious than temporary storage or file transfer. But putting them in the same basket as SSDs is just plain wrong.
  33. Wednesday, 20 June 2018 21:43
    I have tried that, it didn't work. Even disabling the Secure Boot, selecting the external HD in the boot menu, the system hangs in a black screen.
    1. Thursday, 21 June 2018 17:46
      If you saw the GRUB menu the problem is probably that your hardware requires some kernel parameter. Google search is your friend. I remember that I HAD to use a parameter for my Intel NUC to activate the onboard graphics. I can't check what it is now since that machine is currently at my vacation home.

      If you didn't see the GRUB menu at all there are three possibilities. One, the EFI partition is not formatted as FAT32, is not marked as an EFI partition or does not contain the correct EFI binary. Check the instructions above carefully. Two, GRUB is not installed on the correct partition or the partitions you tell it to look for the kernels are wrong (hint: check the UUIDs in /etc/fstab and compare them with those returned by blkid). Three, everything is set up properly, the drive boots on another machine but your current machine is finicky / has a broken UEFI. My Intel NUC was giving me absolute hell with that. I had to unplug everything, wait 30", hold down the power button and then plug in the power. Once in five tries it worked. The same drive was booting perfectly with my Slimbook Katana KDE and even with a SurfaceBook Pro. Go figure.

      Booting from USB is hard and mostly a crapshoot. The more you read about how it works the less plausible it sounds that it can ever work, at all...
  34. Friday, 29 June 2018 22:04
    When I mount my newly made fat32 partition, there's nothing in it. i set the flags and everything haha. am i missing a step?
    1. Monday, 02 July 2018 01:42
      If you just created a brand new partition and formatted it as FAT32 it stands to reason that it has nothing inside it. Unlike EXT3/EXT4 partitions, FAT32 partitions don't have a lost+found directory (in fact, that name would be illegal in a FAT32 partition) since they don't have a feature for recovering lost inodes.
  35. Sunday, 08 July 2018 10:36
    Hi nick,
    great guide and amazing dedication to the comments section by the way.
    Im having trouble with the USB host controller.
    It seems your fix is missing from my HP envy's bios settings :/ is there any other way to enable the xHCI on boot setting?
    1. Sunday, 08 July 2018 23:07
      It depends entirely on the firmware of your laptop. FWIW the NUC gave me grief half of the time I tried booting it up. Ironically, a Microsoft Surface Book and a Mac Mini I was also using this solution on didn’t bat an eyelid and worked the first time around. So I guess it’s just very hit and miss.
  36. Thursday, 12 July 2018 17:33
    Would remove the internal hard drive during the install make it easier? You wouldn't have to fix Windows 10 partition that way.
    1. Thursday, 12 July 2018 20:42
      It depends on whether it's possible to physically remove the drive (newer laptops have NVMe drives soldered to the motherboard) and how your UEFI firmware reacts to its main boot option being removed between cold boots. Please read the previous comments where I have discussed about it in length.
  37. Monday, 16 July 2018 13:09
    Hi, NIcholas! I tried your instructions step by step, but it didn't work for me. I was trying to install Ubuntu 18.04 on Seagate M3 1TB external USB HDD, and after a long fight, I found that the problem was actually in the size of the FAT32 partition that had to be created for the boot loader. It has to be LARGER THAN 512 MB, otherwise it won't work. Here is what I did:
    1. I connected both the USB HDD and the USB flash drive with the Ubuntu startup burned on it to the computer (Laptop ASUS X55C).
    2. Started the computer. I had to press the "Esc" button to see the boot menu; I chose "UEFI: Udisk 8GB", which is my Ubuntu 18.04 flash drive.
    3. I created new partition table (msdos) in the Seagate HDD using gparted, and since the Ubuntu installation partitioner kept going on with the annoying message that I hadn't used the correct alignment, I made all the partitions needed for the installation with gparted. First, I made a logical swap of 16GB at the end of the freed space. Second, I made a primary 650MB FAT32 with boot, ESP flags at the beginning of the free space, and at last - in the remaining middle - an ext4 partition.
    4. After these actions, it was time (finally) to start the installer. When I was asked where to install, I chose "something else". On the partition menu I found the Seagate HDD mounted as /dev/sdb. /dev/sdb2 was my FAT32 recognized as EFI partition, /dev/sdb3 was my ext4 partition, and /dev/sdb1 was the swap partition. I order to set the mount point of the ext4, I had to select it and click "change" on the menu. Done.
    5. The final step: on the bottom of the partition menu, there is an applet where you choose, where to install the boot loader - I chose /dev/sdb (the Seagate USB HDD). This is very important.
    6. Installation.
    After installation I restarted... ''Esc'' button, and... YESSSS - a miracle! Finally I saw the long expected "UEFI: Seagate M3"... and it successfully booted!
    Before this success I got only "Seagate M3" on the menu, without "UEFI", which wouldn't boot at all.
    I hope this little clarification about the FAT32 partition will help someone, well - it's working for me.
    Wish you all the best!
    1. Monday, 16 July 2018 13:52
      It sounds like you put the entire /boot in the FAT32 partition which is wrong (but explains why you needed that much space). The FAT32 partition must be mounted to /boot/efi. You can either have a separate ext4 partition for /boot or just leave /boot in your root partition (as long as you are not using an encrypted disk, that is). /boot needs to be at least 512MB, ideally 1GB, in size since it holds all the kernels, GRUB2, initial RAM disks and a few odds bits and pieces. /boot/efi (the EFI system partition) needs to be FAT32 and can be as small as 100MB since it only holds the EFI stubs which kickstart the boot loader.
  38. Tuesday, 24 July 2018 19:52
    What if my main HDD (the one that has windows in it) is NTFS formatted?
    1. Wednesday, 25 July 2018 18:48
      This is irrelevant since you are installing on a new, blank USB HDD which you are formatting during the installation of Ubuntu. Your Windows installation, in the main HDD, has its boot configuration recovered after Linux is installed. This is basically 60% of this post, from "Fix Windows 10 boot" onward.
  39. Thursday, 26 July 2018 00:51
    Καλησπέρα, διάβασα το post σου για να στήσω τα ubuntu σε εξωτερικό σληρό (και με βοήθησε πολύ!). Τώρα θέλω να κάνω αυτό που στο installation των ubuntu ονομάζεται full system encryption και σου στέλνω γιατί δεν βρήκα πολλές πηγές online. Βρήκα αυτό αλλά δεν είμαι σίγουρος εάν είναι η ευκολότερη λύση να το κάνω έτσι (και αν θα πετύχει). Έχεις πειραματιστεί με κάτι σχετικό? Σκεφτόμουν ότι ίσως να μπορούσα να κρυπτογραφήσω όλο τον σκληρό αλλά δεν είμαι σίγουρος εάν θα μπορώ να κάνω boot τα ubuntu γιατί θα έχει κρυπτογραφηθεί και το efi partition..

    1. Friday, 27 July 2018 15:31
      Καλησπέρα! Δεν έχει κάποια διαφορά για το full disk encryption και ναι, το δοκίμασα και αυτό λόγω GDPR :) Στην εγκατάσταση του Ubuntu πες του να στήσει encrypted LVM και προχώρα κανονικά. Δημιουργεί ένα ΜΗ κρυπτογραφημένο partition για το boot. Όσο για το EFI partition είναι πάντα μη κρυπτογραφημένο.

      Το full disk encryption λειτουργεί ως εξής. Το firmware της συσκευής ψάχνει το EFI parition. Από εκεί διαβάζει το EFI που ουσιαστικά είναι ένα shim, ένα μικρό πρόγραμμα που φορτώνει τον πραγματικό boot loader. Ο πραγματικός boot loader (GRUB2) βρίσκεται στο /boot. Πρέπει να είναι μη κρυπτογραφημένο γιατί ακόμη δεν έχουμε τρέξει κώδικα για την αποκρυπτογράφηση. Μόλις επιλέξεις Ubuntu από εκεί, ο GRUB2 προσπαθεί να φορτώσει τον kernel. Αν η συσκευή σου έχει ενεργοποιημένο το secure boot το firmware ελέγχει την υπογραφή του kernel. Αν η υπογραφή είναι έγκυρη (ή απλά δεν έχεις secure boot) ο kernel οφρτώνεται στην μνήμη, ξεκινάει το process 0 (kernel process) και φορτώνει το initial RAM disk από το μη κρυπτογραφημένο /boot. Μέσα στα πολλά που κάνει, το initial RAM disk φορτώνει το LUKS που σου ζητάει τον κωδικό σου. Βάζοντας τον κωδικό σου αποκρυπτογραφείς το (μεγάλο σε μέγεθος) κλειδί του LUKS το οποίο στην συνέχεια χρησιμοποιείται για να αποκρυπτογραφήσει τα δεδομένα του κρυπτογραφημένου partition. Στην συνέχεια αναλαμβάνει ο LVM (Logical Volume Manager) ο οποίος κάνει τον kernel να "βλέπει" εικονικά (γνωστά και ως "λογικά") partition π.χ. το root partition, τυχόν swap κλπ.

      Το σημαντικό σε αυτή την διαδικασία είναι πως ο EFI loader, ο boot loader, ο kernel και το initial RAM disk είναι ΜΗ ΚΡΥΠΤΟΓΡΑΦΗΜΕΝΑ καθώς εκτελούνται στα στάδια προτεοιμασίας του συστήματος, πριν εκτελεστεί το LUKS. Ως εκ τούτου δεν σου δημιουργείται κανένα απολύτως προόβλημα με άλλα λειτουργικά. Το dual boot (συμπεριλαμβανομένου του boot από εξωτερικό δίσκο) με full disk encrypted Linux παίζει μια χαρά.
      1. Friday, 27 July 2018 18:55
        Ευχαριστώ για την απάντηση! Δεν μπορώ να πώ στην εγκατάσταση του ubuntu να στήσει encrypted LVM γιατί δεν υπάρχει σαν επιλογή όταν επιλέγουμε "Something else". Βρήκα αυτόκαι έστεισα κρυπτογραφημένο system partition στο οποίο βρίσκονται τα boot,root και swap. Σε άλλο partition στον σκληρό έφτιαξα ένα efi partition το οποίο είναι μη κρυπτογραφημένο. Υπάρχει κάποιος τρόπος με αυτό το setup να κάνω boot?
        1. Saturday, 28 July 2018 08:20
          Κάτι αντίστοιχο έκανα εγκαθιστώντας το Kubuntu στο Surface Book μου τις προάλλες. Δες το "Prepare the disk encryption" και το "Install Linux and fix the disk encryption on the installed system" από αυτό το άρθρο. 

          Ο installer του Ubuntu / Kubuntu / Lubuntu / Xubuntu σκάει αν πας να του κάνεις manual dull disk encryption μέσα από το περιβάλλον του. Αν στήσεις το LUKS και το LVM με το χέρι πριν την εγκατάσταση παίζει μια χαρά. Το θεματάκι του είναι πως δεν φτιάχνει το crypttab και δεν ενημερώνει το initial RAM disk οπότε πρέπει να το κάνεις με το χέρι. Οι οδηγίες που έχω σε εκείνο το άρθρο παίζουν δοκιμασμένα και θα παίξουν χωρίς πρόβλημα και σε εξωτερικό δίσκο (η μόνη διαφορά εσωτερικού με εξωτερικό δίσκο είναι το τι κάνουμε στο EFI partition στην τελευταία περίπτωση). 

          Ελπίζω αυτό να βοήθησε!
  40. Saturday, 28 July 2018 21:42
    A question, if Un-plug or disabled in BIOS my main hard-drive, in order to isntall ubuntu on my external HDD, then I don't need to do all of this right ? (i mean fixing windows boot, and creating the boot for ubuntu in the external hdd)
    1. Saturday, 28 July 2018 22:02
      No, this is NOT correct. Please see https://dionysopoulos.local.web/253-portable-ubuntu-on-usb-hdd.html#!/ccomment-comment=551

      You will definitely need to fix the EFI partition on the external drive. Also, depending on how your device UEFI firmware works, you MAY end up losing access to Windows completely.
  41. Saturday, 04 August 2018 12:43
    I have a similar issue to Debneil where it says the mount point doesn't exist after trying to mount to /mnt/boot/efi in the EFI partition - however, I think I've done all the necessary steps to this point. I've included the prompts from fdisk, GParted, and the fstab file here:https://imgur.com/a/36wrcqs. I will note that there was no boot/efi in the original fstab file. Any help would be greatly appreciated, thanks!
  42. Friday, 10 August 2018 12:05
    Nice guide. Gonna try this, this is exactly what I was looking for. Thanks for putting effort to write it.

    On the "Fix Windows 10 boot" rollback you probably meant

    "ren BCD.old BCD" and not "ren BCD BCD.old"

    1. Friday, 10 August 2018 12:08
      Correct :)
  43. Saturday, 11 August 2018 15:59
    Hi, I do not understand this:

    sudo umount /media/ubuntu/01234567-89ab-cdef-0123-4567890abcde

    This means to unmount the external hdd / partition? Is it mounted now, in fact should we run gparted on mounted devices? It gives some denial message for me anyway.
    1. Sunday, 12 August 2018 18:57
      You only run GParted to find the UUID. You do not commit any operations so it's safe to use. You can always use blkid on the command line to do the same. It's just that GParted is simpler for people to understand.

      The umount is only necessary if Ubuntu automatically mounted the filesystem. The reason is that we need to mount the partition under /mnt so the rest of the instructions will work. If your partition is not mounted (check with cat /proc/mounts) you can continue with the mount command onwards.
      1. Wednesday, 15 August 2018 14:18
        Thanks for the reply. The umount had failed in my case because the path was /media/xubuntu, which I really did not expect...

        Anyways, I have installed the distribution and it is there, but the last step, the crucial one, the creation of the boot loader partition, somehow did not work. I have received no error messages (I have followed the steps closely), but I seem to have the same problem as José Pedro Silva, /boot not found error is displayed on start-up. I can boot into the installation because the computer I did this on is dual boot and grub somehow replaced the original LINUX partition entry with the external disk entry. Now I do not know how to fix it other than trying the steps again, which did not work the last time. I do not suppose so, but if you had an idea, I would appreciate it.

        1. Friday, 17 August 2018 13:16
          It looks like you selected the wrong location for installing the boot loader when you were installing on the external drive. Instead of the external drive you selected the internal and that caused the issue.

          Fixing it is possible, though not immediately obvious.

          Boot your computer from an Ubuntu installation flash drive. Open a console and do:

          sudo su
          mount /dev/sdXA /mnt
          mount /dev/sdXB /mnt/boot
          mount /dev/sdXC /mnt/boot/efi
          for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i; done
          cp /etc/resolv.conf /mnt/etc/
          modprobe efivars
          chroot /mnt
          grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ /dev/sdX

          - /dev/sdX is your internal hard drive, typically /dev/sda
          - /dev/sdXA is the internal hard drive's root partition, typically /dev/sda2
          - /dev/sdXB is the internal hard drive's /boot partition, typically /dev/sda1. If you do not have a separate boot partition skip that line.
          - /dev/sdXC is the internal hard drive's EFI partition, e.g. /dev/sda3.

          You are mounting the internal drive's regular Linux installation and putting yourself in a chroot jail. At this point your commands work as though you were booted into your regular installation. The final line installs GRUB2 on your internal hard disk, overwriting the previously installed GRUB.
          1. Thursday, 23 August 2018 10:58
            I had actually thought that the forum had swallowed my last message, sorry for the late reply. I had not read the situation correctly, the boot loader was actually the one on the external hard drive, because my last desperate attempt was trying to run the chroot procedure from my dual boot system. Which for some reason worked, but the boot loader is identical to my dual boot one, which confused me. Anyways I now have working LINUX installation with some extra grub entries which suits me fine, some day may be I will learn how to prune them.
  44. Wednesday, 15 August 2018 20:06
    Hi Nicholas, Many thanks for this instructions!

    I would suggest a shortcut to the procedure:
    - Choose to install Linux "somewhere else" (basically the menu option for advanced entries)
    - During the linux installation, create additionally a ~500MB participation and mark it as EFI
    - Select that EFI as the place where to install the Linux boot loader.

    After the Linux installation completes, you would still have to fix the windows EFI (bcd rebuild) but you would not need any additional step above.
    1. Friday, 17 August 2018 13:20
      I'd like to point out that selecting the EFI partition of the external drive as the target for the boot loader during installation does not solve the issue that most computers will ignore it. So while it's possible, it's not a universal solution and that's why I didn't follow it. That and it makes it harder for me to explain in the article how to find the external drive's EFI partition.
  45. Tuesday, 21 August 2018 22:30
    Umesh Sharma
    First of all, thanks a lot for very informative article. I followed your instructions totally and installed Ubuntu 18.04.1 LTS on external HDD (USB3), the OS in my Dell laptop (EFI firmware) is Windows 10. Your solution works perfectly as long as I connect the external HDD on my Dell laptop, even with secure boot enabled. However, when I connect the same on my son's HP laptop (HP envy 14-j106tx), also with EFI firmware, the disk goes into emergency mode and there is no way I can boot. It seems the solution works only on the machine on which the installation is made. I am not experienced with Linux, I read in an article (https://askubuntu.com/questions/847860/how-can-i-make-a-portable-ubuntu-installation-on-a-usb-stick-secure-bootable) where the solution given was as follows:

    How can I get secure boot working also on multiple machines?
    this command solved my problem now:
    grub-install --efi-directory /mnt/esp --boot-directory /mnt/rootfs/boot --target x86_64-efi --removable /dev/sdb --uefi-secure-boot
    this finally lets me boot on uefi systems with secure boot enabled. the only errors I get while booting is
    error: file ´/boot/' not found.
    error: no such device: /.disk/info.

    I tried the solution given above; the command could be executed with my HDD plugged-in after booting through Live USB. But there was no success as far as portability is concerned and I get the same message on connecting to HP laptop. Any suggestions in this regard?

    1. Thursday, 23 August 2018 11:19
      I believe that enabling secure boot on a portable device will break things because you are tying the boot to the exact hardware configuration at the time you created the boot loader. Portable installations shouldn't do that, you want to be able to boot them anytime.

      I don't know why the HP won't boot it. Have you tried booting an Ubuntu installation disk? Maybe that will point you to the right direction for troubleshooting.
      1. Tuesday, 28 August 2018 19:08
        I am able to boot through the Live Ubuntu USB on HP laptop, there is no problem there. I am not able to boot the installed USB HDD with secure boot enabled. I accept your contention that with secure boot enabled the portability may not be possible.

        I wish to clarify two doubts. In your procedure, you are creating EFI partition after installation of Ubuntu. Are you suggesting to do the initial installation in legacy mode? Second doubt: is it not better to make EFI partition while making other partitions, what is the advantage in shrinking the root partition after Linux installation to create EFI partition?
        1. Tuesday, 28 August 2018 21:04
          When I wrote the article the Ubuntu installer would detect the EFI partition on the main drive and install its EFI stub there.

          Remember that the EFI System Partition (ESP) and the boot volume (what is mounted on /boot) are NOT the same and have a different purpose in life. The device firmware looks in the ESP of each attached hard disk for EFI stubs. These are presented in the device's boot menu. The GRUB EFI stub (installed by Ubuntu) will find your boot partition and load GRUB from it. GRUB will then present its own boot menu. Once you make a selection, GRUB loads the kernel (vmlinuz) and mounts the initial RAM disk which initializes the system and its devices etc.

          While you can create an ESP in the Ubuntu installer it's not necessary that this is the one which will be used, i.e. the one where Ubuntu will install its EFI stub. Even if it does, it installs a regular stub which is NOT meant for removal drives. So you'd still need to follow the advice to enter the chroot jail on the external installation and install GRUB with the --removable option.

          That bit would be very difficult to describe. The only people who'd get it are the ones who don't need to read this article. Therefore I chose the easy method of describing how to create an ESP on the external drive after the fact.

          Predictably, people try to be "smart" and do things differently than I described without understanding or researching the repercussions. Little wonder people end up telling me "it doesn't work for me, oh by the way I did Y instead of X". Yeah, sure, you can create an ESP during installation but if you don't reinstall GRUB with the --removable option it will only ever work on the machine you originally built the installation since you don't have a removable media EFI loader. If you had Secure Boot enabled it will also not work anywhere else because you're locking the boot loader to the specific hardware configuration; if it changes it invalidates the boot loader. If you don't have Windows the instructions won't work because the installer is likely doing something silly, like replacing your main installation's boot loader with its own. If you unplug your main hard disk it might not work because you are neither reinstalling GRUB with the --removable option nor do you account for most machines recording the new ESP in their NVRAM, breaking your main installation. I have run into these problems and that's why I don't do any of that.

          Follow my instructions to the letter and everything works. I have done that three times with different machines and SSDs. I know these instructions work, if you actually follow them.
          1. Friday, 31 August 2018 21:34
            thanks for very detailed and informative reply. As I wrote in my first post, I did exactly as per your instructions and everything worked. The doubt why not create the ESP partition while creating other partitions was only due to the fact that it is easier and faster to create an additional partition when all the other partitions are empty compared to carving out a partition from the root partition which has system already installed on it. I accept your reply and the matter ends here.
  46. Wednesday, 29 August 2018 17:49
    Great tutorial, I think, but I have a very preliminary issue.  I cannot get Ubuntu installed on the SSD.  I keep getting an offset from the beginning of the drive, which results in an error message "the partition assigned to "/" starts with an offset ...please go back and fix". Gparted can delete the offset, or at least it does not show, but the installer recreates it, result can't install.  Any suggestions. Thanks.
      1. Friday, 31 August 2018 00:42
        Okay, got that problem solved.  I had to use an external partition program to set up the ssd, no problem.  Installed Ubuntu, seemingly no problem.  Worked well in its installed state.  However, when I shut down, there was no impact on the windows bootmanager. Booted into windows with, or without, ssd connected.  Should I go ahead and make the changes in Ubuntu on the ssd, or would they be futile?  Thanks for your help.  I'm an old, old dog trying to learn new tricks -- think Commadore 64.
        1. Friday, 31 August 2018 09:20
          Yes, you need to make the Ubuntu changes to the SSD. This is what makes it bootable on other computers as well.
  47. Sunday, 02 September 2018 23:20
    I wondered if all the hassle would be avoided if I disconnected the internal hard drive of an old computer (not the one I plan to use the drive on often) that had windows 10 on it. If the only drive the computer recognizes is the external one, then would GRUB be installed on the drive like normal? That is just using the "normal install" option on the drive. or would i have to create a swap, root-home, and efi partition with grub, etc. And would this approach still work on any computer, fully portable? I would love to here your response, as I don't want to be using the virtual machine for class any longer and am worried about the process you detailed adversely affecting any of my machines
    1. Monday, 03 September 2018 11:47
      Already answered in the comments.
      1. Monday, 03 September 2018 16:43
        well if that doesn’t work apparently, then can i do the tutorial steps on said old windows pc  and still be able to use it everywhere?
        1. Monday, 03 September 2018 16:47
          Considering that this is quite literally what the post describes and that I am actually posting this from the bootable portable installation attached to a different computer than the one I originally used I would say that yes, it will work.
  48. Tuesday, 04 September 2018 10:03
    Did the whole tutorial from start to finish, everything seemed to work fine, the drive booted from the pc with no problems. however when i try to boot it from the computer i plan on using it on (the other was an old pc i didn’t care to do the process on) i get a multitude of ACPI errors. after these errors the shell reads “you are in emergency mode. after logging in...etc” “press enter for maintenance (or press control-d to continue):”. i would like to know what this means and how i can fix it, as i feel i was so close to getting it to work.
    1. Wednesday, 05 September 2018 16:22
      I can tell you what I'd do in this case: Google the error message I see on the screen.
  49. Tuesday, 31 January 2017 09:42
    Nice instructions. I'm fighting currently with exactly that problem.
    One question/comment: In your chapter "Secure boot caveat" you wrote: "I've only tested these instructions with Secure Boot turned off". Here you are referring to the option in the ubuntu installation, right? I first thought you are talking about turning UEFI-Boot off in the "BIOS" (I know it is not called anymore BIOS)
    1. Tuesday, 31 January 2017 09:52
      I was talking about the UEFI firmware setting. You're right, it's not called BIOS, it's called UEFI Firmware now :)

      Somewhere in the Boot options menu there's a switch for Secure Boot which only allows cryptographically signed bootloaders to execute on boot. If you are using the precompiled Ubuntu kernel and bootloader they are signed and can work with Secure Boot. However, since I'm using grub-install in the last step I am not sure if I'm breaking the signature. If your PC barfs a message about unsigned bootloaders, invalid signature or you get to simply stare at a black void, er, screen then this might be the case.
    1. Wednesday, 08 March 2017 17:45
      Hi Alec! Apparently I did answer your question (I'm adding the link since you pasted it wrong above). You still need to fix the Windows boot section as I described. That's necessary for the small UEFI boot stub to live in the correct place. The BitLocker encryption settings are stored in the NTFS filesystem itself. Therefore Windows knows that the volume requires decryption and the decryption key is safely tucked away in the machine's Trusted Platform Module.

      FYI, that's the same principle which allows you to run UEFI live Linux distributions on your PC without being able to access the encrypted volume but also without damaging it. Moreover this is the same principle behind being able to repair a damaged UEFI partition without losing all the contents of your hard disk. BitLocker is a very well thought out full disk encryption solution. However, it's always a great idea keeping a backup and a backup of the backup before doing anything which could have even the remote chance of screwing up your computer. Better be safe than sorry!
      1. Thursday, 08 June 2017 02:29
        Hi again. After a long time I came back to this. The bootrec /fixboot rec dosnt work for me (dosnt find windows). I think because the dirve is bitloked and I dont have the key to unlock it in recovery. Anyhow since I forced the boot order in bios the machine was booting normaly just no longer finding the ubuntu on the SSD and the BCD looked normal. I followed the rest of your instructions and all is now working. Boots to windows with no SSD and boots to ubuntu with SSD when selected as boot media. so many many thanks for your instructions! If only Ubuntu had an install option that let you spesify where to put the grub!
        1. Thursday, 08 June 2017 12:34
          If you have a drive protected by BitLocker you need to use a Windows 10 recovery DVD and first try to use its Repair option. It will ask you to enter the BitLocker recovery code which you have either printed out or it's stored in your Microsoft account (default for self-owned machines). Even if the automatic repair fails you can then go to the command prompt and do everything you need - the drive is now unlocked.
  50. Monday, 26 June 2017 02:41
    Been for days trying to fgure out how to do this.. seems to be a Ubuntu install limitation. First the bootloader was installed on the PC harddisk, without me wanting it .. then made the EFI partition with the proper flags but no matter what I tried, it never installed the bootloader on that partition. Finally read somewhere that Ubuntu only installs automatically EFI if partition is sda, since i am booting for a live usb to install in other, the media is always sdb.. really really thank you!!!
  51. Friday, 30 June 2017 18:54
    Also, this only works for UEFI, not BIOS right?
    1. Saturday, 01 July 2017 19:07
      Yes, that's UEFI only. I don't have a computer with legacy (BIOS) boot to test. I'm pretty sure that if you have 2Mb of free space in the beginning of your hard disk you can install a GRUB MBR there. It's been too long since I last did that and it was with GRUB 1 so don't ask me how :(
  52. Saturday, 22 July 2017 19:17
    Thanks! First clear description of what's going on, and how to make it work. Finally got my external SSD to boot.
  53. Saturday, 05 August 2017 03:05
    Hi, thanks for your write up. Does running an OS installed on a USB drive risk damage to the drive and premature failure? Or is it safe to do without having to worry about even wearing and write rates? I assume the technology in the drive is different to old HDD or SSD and not necessarily designed for this type of use or is it all good?
    1. Sunday, 06 August 2017 10:02
      Wear leveling is a feature of the SSD itself. It doesn't matter which system bus / connector the SSD is attached to (SATA, mSATA, PCIe via M.2, USB...). The bus selection only affects maximum throughput, not wear leveling.

      Modern SSDs are designed to be used as the primary or only storage medium of a computer. Otherwise devices like the Apple MacBook Pro or the Microsoft Surface Pro wouldn't be possible. For average (non server) use SSDs and HDDs have practically comparable lives.

      Please note that I used a "real" SSD in a USB enclosure. If you use a flash drive your mileage will definitely vary (and be much, much shorter). Flash drives are not designed with a long write cycle in mind. They are also woefully inadequate in terms of speed. If you want to have an OS on a portable drive use a regular SSD in a USB 3.x enclosure.
      1. Sunday, 06 August 2017 12:40
        Very helpful, thanks mate!
  54. Friday, 25 August 2017 18:22
    Hi. Thanks for these instructions and they did help, but I'm still unable to boot from my external hard drive. I get 'System BootOrder not found. Initializing defaults' error message and then restarts. I tried installing Linux Mint on one of my external drivers and can confirm that i was able to install the OS successfully and also the grub install with the removable option fine with no errors. Its only during boot that I'm stuck. Any one else faced similar issue?
    1. Saturday, 26 August 2017 11:38
      This seems to be a UEFI firmware issue. First make sure that Secure Boot is disabled in your UEFI setup (what we called BIOS setup in the olden days). I never had any luck booting Linux off removable media with Secure Boot enabled.

      If you still have this issue you may want to use efibootmgr as root, e.g. from a bootable USB stick with Linux, to set up the UEFI boot load order. See this question on LinuxQuestions.

      1. Saturday, 02 February 2019 23:52
        Hi Nicholas,

        I have the same problem. I followed all your steps in one Desktop PC with UEFI BIOS with Secure Boot Disabled. And i was able to boot Ubuntu from External USB HDD.

        However, when i take the same HDD and boot in a laptop with UEFI BIOS with/without Secure Boot, it doesn't boot at all. UEFI BIOS shows 4 options as below.
        1. ubuntu
        2. Windows Boot Manager
        3. NVMe:
        4. USB HDD:
        5. PCI LAN

        Selecting Ubuntu does nothing.
        Clicking 4th option (HDD containing Ubuntu), goes to a black screen which says "System Bootorder not found. Initializing defaults. Reset system".

        Can you help here?

        I even booted a Ubuntu live from an USB stick in this laptop and reran commands given under "Make sure the Ubuntu installation on the external HDD can see the ESP", "Install GRUB2 on the external drive’s EFI System Partition". But this didn't help.
        1. Sunday, 03 February 2019 11:27
          Boot your portable installation on the machine it works.

          Look in /boot/efi, your EFI partition should be mounted there. If it's not you will need to edit your /etc/fstab and reboot.

          If the EFI partition is mounted, check if the file /boot/efi/EFI/Boot/bootx64.efi exists. If it doesn't, you need to run
          grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdX
          where /dev/sdX is the device where the EFI partition is mounted. If you are not sure run
          mount | grep boot/efi

          If this doesn't help, your problem is with your /etc/fstab. The leftmost column should have UUID=something for all entries. If it has device names, like /dev/sda1, you can run blkid to see the UUID for each corresponding /dev entry. You can replace them in /etc/fstab and reboot. For example, if /etc/fstab has
          /dev/sda1 /boot/efi vfat umask=0077 0 1
          and blkid says
          /dev/sda1: UUID="ABCD-EF01" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="01abc234-def5-6a7b-8c90-0123456789ab"
          you should change the /etc/fstab line to
          UUID=ABCD-EF01 /boot/efi vfat umask=0077 0 1
  55. Monday, 12 November 2018 00:34
    Hi Nicholas, I followed all the steps in the post and succesfully installed the bootloader on the HDD, but when I try loading ubuntu from it, an error pops up that say: Linpus lite boot failed.
    I have no idea why is this coming up. Please help.
    1. Monday, 12 November 2018 17:49
      My blog post is written about Ubuntu. I have not used Linpus Lite. The only thing I understand from the message is that you have probably not updated /etc/fstab with the UUIDs of your partitions.
  56. Wednesday, 14 November 2018 02:45
    It is probably an issue with the BIOS of my system. I used the same HDD on other system and it booted perfectly. No Linpus Lite error or anything. I have updated the BIOS on my system but still can't boot it from there. Any suggestions ?
    1. Wednesday, 14 November 2018 11:05
      If it's a hardware issue you probably need to look at the computer manufacturer's site for more information.
  57. Thursday, 15 November 2018 22:05
    Hello Nicholas!

    Thank you very much for all your work and responses!

    I have just one question:
    Is it possible to circumvent the Windows-fixing-boot issue, if I do the whole procedure on a Linux machine in the first place?
    1. Friday, 16 November 2018 10:59
      Yes, of course. That step is only required when you carry the procedure on a Windows machine. If your machine is Linux you don't need to do that.
  58. Saturday, 24 November 2018 04:15
    Signing up for comments. (I may have hit the "Unsubscribe" button by mistake.)
  59. Friday, 30 November 2018 04:26
    […] Make a full portable installation on a USB HDD […]
  60. Saturday, 01 December 2018 04:42
    It works!!! thank you so much!!!

    My experience in fixing Windows 10 boot: I boot Win10 and then restart Win10 holding SHIFT key. Wait with SHIFT hey down until blue screen appears with some options. click on Troubleshoot > advanced options > command prompt. ([url=https://www.digitalcitizen.life/4-ways-boot-safe-mode-windows-10])

    Once in the windows command prompt I follow your instructions:
    ":>bootrec /FixBoot" --> trowed me "Access denied"

    But then I run
    :>ren BCD BCD.old
    :>bcdboot c:\Windows /l en-us /s z: /f All

    And this works like a charm!
    1. Saturday, 01 December 2018 11:38
      I am confused as to why you are complaining that doing something other than what I wrote in the article didn't work. I clearly say "Boot from the Windows system repair disc USB drive (or a Windows installation or rescue CD-ROM / DVD-ROM)". I do not say "click on the Windows start button and choose command prompt" which is what you did and of course won't work because you're not using an elevated (Run as Administrator) command prompt.

      Thank you for confirming that the right way to do it is actually following my instructions. Holding down SHIFT on boot and choosing Troubleshoot does, in fact, start Windows System Repair from the hidden partition on your disk -- if there is one to begin with.
  61. Saturday, 29 December 2018 10:23
    i managed to boot the external hdd on 2 dell computer. However the computer which i use to make the external hdd cant detect the hdd. i have off secureboot and fast boot and am using a hp-pc. any idea where i might have gone wrong?
    1. Saturday, 29 December 2018 21:16
      If it cannot see it at all (even under Windows, as disk partitions) you probably have a hardware incompatibility. I had an ADATA SSD which worked on everything except a Surface Book I used to own.

      If you can see the partitions but cannot boot from the external drive try disabling Fast Startup on Windows and then shut down your computer. Some devices' firmware bypasses external HDD/SSD detection when Fast Startup is enabled. That's what ultimately worked for my Intel NUC.

      If that doesn't help ask the manufacturer if there's something special you need to do to UEFI boot from an external HDD/SSD (which is different than booting of a USB stick).

      As a method of last resort you could clone the EFI partition on a USB stick and use it to boot the external hard drive but it's kind of a kludge and takes away the whole point of having a bootable Linux hard drive.
  62. Saturday, 12 January 2019 02:33
    Thank you so much! I've been struggling with this for days. Finally solved. Keep it up!
  63. Monday, 21 January 2019 10:03
    Your guide is amazing, one of the only real ones out there for a portable full Linux install.

    I have a minor problem, everything works fine but on boot I get 2 lines of errors for /boot invalid file or directory, is this from.

    Just FYI when partitioning I added a boot partition and selected the grub install to be there ( was surprised to see a black screen )

    I'm guessing it's a path issue, but since everything works I'm not sure what's going on
    1. Monday, 21 January 2019 10:15
      I am not sure what is the exact error you are receiving, so all bets are off. I would suspect that your /etc/fstab has the wrong UUID for the /boot filesystem. You can fix this. Then you should reinstall GRUB2 following the last part of this article.

      Otherwise, do what I do: Google the exact error message. Chances are someone else had the same or a similar issue and someone else told them how to fix it.
      1. Tuesday, 22 January 2019 00:37
        Yeah I'll have to do some digging, I suspect it's cause I had made a separate boot partition initially and the fstab is pointing to it, or maybe a firmware / GRUB bug but I doubt it.

        fstab does point to the newly created EFI partition on the line you specified above, if I find a fix I'll make sure to post it here.

        The error was a quick flash before GRUB loaded so I was having trouble getting it down, 3 lines:
        error: file '/boot/ not found
        error: no such device: /.disk/info
        error: no such device: /.disk/mini-info

        After those GRUB loads normally.
        After updating the OS including the kernel, everything still is working honky dory aside from the minor error annoyance.
  64. Friday, 25 January 2019 07:41
    When I was installing Linux I have created the EFI partition and it asked me where to install boot manager. I chose the external HDD and it did not corrupted the windows boot loader. I also skipped the step to add the EFI partition. Btw I also used btrfs and it did not cause any issues. Any ways. Thank you for your post. It is really helpful.
    1. Friday, 25 January 2019 12:08
      Thank you for your feedback!
      1. Wednesday, 20 February 2019 03:38
        I was totally wrong. And I had to pay for it. One day my laptop stopped recognize my USB drive as a bootable device (no idea why) but because there were no fallbakc path it was really hard to recover to the working state. Thanks to this article! I was able to continue and finish the proper setup.

        You saved my day twice. :)
        1. Thursday, 21 February 2019 13:35
          Now you know why I followed this roundabout method of installing Ubuntu's EFI loader ;) Having a separate EFI partition and using the generic EFI executable name is very important to ensure that the external drive will be bootable anywhere, even on computers with completely trashed EFI setups.
  65. Tuesday, 29 January 2019 11:14
    Using boot-repair with Live-Ubuntu does the job of fixing the EFI on USB drive in comfortable way.

    sudo add-apt-repository ppa:yannubuntu/boot-repair
    sudo apt-get update
    sudo apt-get install -y boot-repair && boot-repair
    1. Tuesday, 29 January 2019 13:47
      NO! This is WRONG! Do NOT do this. Boot Repair was designed to fix common boot issues on permanent, not portable, installations. There are very different assumptions made than our use case. In fact, in this very article I explain the difference for EFI. Read the article again and inspect the EFI partition on your (non-)portable drive. Do you see what is the problem now?
  66. Tuesday, 26 February 2019 17:18
    Works great! Thanks. Can you comment on using this method with other Linux distros such as CentOS, etc.?
    1. Tuesday, 26 February 2019 17:39
      You're welcome!

      The premise of this article holds true for any Linux distribution using GRUB2 (as far as I know CentOS, Fedora etc all do). What we're doing is basically four steps. Install the distro to an external drive. Fixing up Windows' boot loader which was modified by the previous step (assuming the main drive has Windows installed and is not removable or a major pain to remove, e.g. most NVMe drives). Reconfigure GRUB2 to boot up from an external drive. Last, but not least, update EFI on the external drive to make it bootable anywhere.
  67. Friday, 29 March 2019 14:10
    Is the recovery procedure for Windows 10 still needed if you disable the main HDD from BIOS before installing Ubuntu on the usb drive? I am thinking that this might work and also, each time you want to boot to the Linux disc, you do the same (disable the main HDD from BIOS).
    1. Friday, 29 March 2019 18:42
      In my experience, yes, you do. EFI stores the boot configuration in NVRAM. Installing the Linux bootloader in the default (permanent) configuration changes these entries. Part of the instructions deals with that.

      For the same reason you will most likely need to do the custom EFI installation for Ubuntu. Otherwise your computer's EFI won't see it as a boot drive.
  68. Tuesday, 16 April 2019 04:14
    I figure I will share my experience so that it may help someone. I am brand new to Linux other than a simple college course on it, so it took me a while but I finally got it. There were only a few things I had to do different.
    Firstly, I have a Seagate HDD and I had to use gparted in the first place to fix the partitions before installing Ubuntu. I had to set 1 MB in front of the first or root partition and 0 behind. The rest were 0 before and after. Without doing that, I got the offset by x amount of bytes error when trying to install Ubuntu.
    Secondly, even starting up with the Windows Repair USB, I ended up getting Access Denied when using bootrec /fixboot. So I ended up trying what some other articles said about that. So I ended up using, from X:, format Z:/FS:NAT32 and then bcdboot C:\Windows /s Z: /f UEFI, and then maybe bootrec /RebuildBcd (not entirely sure about this last one, I just know it told me that boot was fixed or something similar and then I exited). I do think though, that something could've went terribly wrong there since I used format. However, It somewhat worked and allows me to straight up boot to Windows. But when I use boot manager, it appears that Ubuntu is still an option alongside my main drive, so I assume I wasn't able to get rid of grub, but I don't have any trouble out of it. So hopefully nothing bad ever comes of it.
    Thirdly I ran into the problem of it not booting correctly. It would go into emergency mode. So I figured it might be because I first made only a 50GB portion for /home and not the entire thing. Alongside that, I ended up with my EFI partition as the last partition and a bunch of unused space in between everything. I then fixed that to where the EFI was directly after root and my /home was all the left over space. The only problem I had then is using gparted to make the 200MB partition, I had to right click and unmount it before I could shrink it and make the partition.
    Other than those, I had to use sudo at the chroot environment stuff because it said I didn't have permission, simple though.
    Then it finally worked. Booted perfectly from both my desktop and my laptop. So thank you so much.
    1. Tuesday, 16 April 2019 12:35
      Sounds like you did a few things wrong.

      The EFI partition on the external drive should have been the first one, formatted as FAT32 and have its EFI flag set. Otherwise the BIOS would probably have a hard time finding it.

      By doing random things with Windows I have no idea what you ended up doing. Sounds like you formatted your EFI partition without removing boot entries first. Therefore your computer's EFI NVRAM still remembers the previous entries, including Ubuntu. That entry has absolutely nothing to do with GRUB whatsoever. The EFI firmware loads the EFI loader which loads GRUB which loads Linux. Your problem is at the first step of the chain, the EFI firmware and its NVRAM. While it's fixable I won't tell you how. Judging by everything else you said you are unlikely to follow instructions. If you start improvising you'll screw up your computer and I don't want you to blame me for your mistakes. So, happy Googling and do keep backups -- you WILL need them.
      1. Wednesday, 15 May 2019 14:16
        Hi Nicholas,
        Thank you very much for the clear instructions.
        I still have a couple of questions, IMHO related to the Dom's post above.
        1. From the original document, I got impression that the EFI partition should be created after the root partition (/dev/sdXY): "Resize the first partition on disk to have another 200 Mb of free space after it." (located in chapter "Create an ESP on the Ubuntu HDD"). But now you say that the EFI partition shall be the first one. I have created EFI after root partition according to the documentation, but my external 1Tb SSD is not visible among bootable ones, so I am thinking about moving things around and making EFI the first partition.
        2. "Bootrec /Fixboot" also throws an exception "Access is denied" for me. I think they may improve something recently (my current OS is Windows 10 1803, installed on Lenovo Y50) causing "access denied" as a side effect. As a temporary workaround, I have moved the "ubuntu" on a second place in boot order in UEFI, and that allowed Windows to start ok.
        1. Wednesday, 15 May 2019 20:31
          1. You are right. You can create it anywhere on the disk. As long as it has the correct flags the UEFI firmware will be able to find it. I got confused with the MBR partitions. Long day, not enough coffee :)

          2. Last Windows 10 I tried this with was the April 2018 update. But I think that is unrelated. 10 second web search led to that: https://answers.microsoft.com/en-us/windows/forum/windows_10-update/windows-10-bootrec-fixboot-access-is-denied/747c4180-7ff3-4bc2-b6cc-81e572d546df?auth=1
  69. Wednesday, 17 April 2019 04:05
    Hey Nicholas,
    I loved this tutorial, and completely installed 17.04 ubuntu on my usb. But it's a bit slow, I tried running it on multiple computers, and it's pretty slow on each one. I was just wondering if You had similar issues maybe or is it because of the portable installation?
    P.S I used 3.0 usb flash drive, on 3.0 port and also tried it on i7 6th gen and 16GBs of RAM
    1. Wednesday, 17 April 2019 13:10
      Yeah, it has happened to me. Most USB 3 flash drives (USB sticks) have a fairly decent read speed and a low write speed. In fact, they are only USB 3 at the connector level; the speed they get is not even high enough to saturate USB 2.

      Use a USB 3 connected SSD. That is, a regular SSD in an enclosure that connects to your computer via USB 3. This is really fast in most cases.

      I say most cases because I have an ADATA SSD which is blazing fast unless you connect it to a Microsoft Surface Book. There's a bug in the SSD's firmware and a quirk in Surface Book's firmware that makes performance abysmally slow.
  70. Friday, 19 April 2019 13:20
    Amazing tutorial!!

    I managed to clone my entire HDD to external drive and boot from it.
    Linux/Ubuntu should make Linux/Ubuntu to Go easier.

    Thank you.
  71. Wednesday, 24 April 2019 17:56
    Thanks. I'll try to repair boot from my usb ssd after kernel update. Possibly the tutorial will be helpfull. To avoid problems with windows boot you can try to install ubuntu from virtual box. Actually I installed ubuntu from virtual box (it abble to avoid your problems with windows boot).
  72. Friday, 26 April 2019 01:45
    Your instructions are clear, but I still ran into problems. Probably because I am newish to Linux. I am trying to create a portable Ubuntu Mate 18.04 install. All went well, until your last two paragraphs where you are creating and entering the chroot system. I got many errors I don't understand.

    mount /dev/sda1 /mnt/boot/efi
    failed, mount point does not exist, so I created it.
    for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i; done
    again, failed with mount points not existing, so I created them and ran again
    The is no /bin
    cp /etc/resolv.conf /mnt/etc/
    This fails because the target is not a file (/mnt/etc does not exist). Then
    sudo chroot /mnt
    fails, because /bin/bash is not available. and
    grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdb
    fails with the following messages...
    Installing for x86_64-efi platform.
    grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
    grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
    grub-install: warning: disk does not exist, so falling back to partition device /dev/sda1.
    grub-install: error: disk `hostdisk//dev/sda1' not found.

    Help. Something has gone wrong, and I don't know how to proceed.
  73. Friday, 26 April 2019 02:57
    Sorted some of the problem...
    /boot only contained /boot/grub so copied the other files from the live system on /sda
    Then progressed to entering the chroot.

    The error when entering the chroot is a very miss-leading "chroot: failed to run command ‘/bin/bash’: No such file or directory", although /mnt/bin/bash does exist!

    It turns out that the libraries need3ed by /bin/bash are missing! In fact the directories are empty!

    I think I need to find out why my install failed to fill those directories, and yet produced no error message.

    1. Friday, 26 April 2019 20:07
      I have now been through the tutorial twice, each time with no errors. (/dev/sda and /dev/sdb were getting swapped about before, and I did not notise). Did have to run the last but one paragraphs as su, but other wise no problems.
      However, no result.
      Now, when I boot off the USB drive, it starts from there, and finally ends up running the installation on the internal drive. Yes - I am sure - gparted shows which partition is mounted where.

      I am left wondering what has changed since the tutorial was written.
      1. Friday, 26 April 2019 20:25
        Nothing has changed. However, it is very important that the EFI partition is the first partition on your external drive, it has the correct filesystem type (FAT32, not VFAT) and flags (exactly two: BOOT and ESP). Also, did you update the external drive's /etc/fstab to point to the correct ESP partition? Finally, did you use the chroot environment to install GRUB?

        Considering your previous comments, you have either not created an ESP on the external drive, have not updated your /etc/fstab on the external drive or have not run grub-install through a chroot environment bound to the external drive. Nothing else justifies having the problems you describe.
  74. Monday, 20 May 2019 23:21
    great tut...thanks
    couple questions
    does UEFI need to be enabled in bios
    i have several configs such as:
    UEFI and legacy
    legacy first
    UEFI first
    does the efi need to be primary, but can be located any where on disk such as 1,2,3...
    do you still need to repair windows bcd, i am on windows 7, this is for a windows 10 repair and i didn't seem to have a need to repair when i rebooted without/with external drive, windows 7 loads correctly
    but when i boot to Ubuntu all i get is black screen with flashing promt
    i do have this:
    mount /dev/sdc9 /mnt/boot/efi
    failed, mount point does not exist
    fstab added correct uuid, it was not listed in fstab, but /; /home; swap was
    noted: it was installed in sdd which was # commented out
    not btrfs is ext4
    sudo umount /media/ubuntu/01234567-89ab-cdef-0123-4567890abcde
    no media mounted
    sudo mount /dev/sdXY /mnt
    no mount point
    do i need to follow install grub2 it seems to be for btrfs?
    my biggest question is about the UEFI, should i change bios to UEFI and legacy and make the efi partition primary? is this gona affect my windows install?
    1. Tuesday, 21 May 2019 15:58
      Um, if UEFI is not enabled in your firmware then, clearly, you cannot have UEFI boot. You can have the EFI partition anywhere on disk. You still need to repair Windows BCD if booting into Windows doesn't work. No, I don't know how it works on Windows 7 -- I haven't used it since circa 2011. Regarding the mount failure, you should NOT be seeing a device name such as /dev/sdc9. I think you've edited /etc/fstab yourself or have an ancient Ubuntu distro from at least half a decade ago.
  75. Wednesday, 22 May 2019 08:52
    I intended to follow this tutorial, but when I saw "Fix Windows 10 boot" using a Windows system repair disk, it just dissuaded me from doing so. I know from experience that the less you touch to that huge labyrinthine system, the better you are.
    So, I went back wandering on the net and I found this : (MODERATOR NOTE: LINK REDACTED)
    In this tutorial, the most easy, simple and elegant solution is the unflag/reflag method : boot on the live USB, use GParted to unflag the internal drive's EFI partition, install Linux on the USB drive, then restore the internal drive boot flags.
    1. Wednesday, 22 May 2019 13:16

      If that works for you, great. However, my 2013 vintage Intel NUC's EFI firmware stores the EFI boot order in NVRAM. The only way I could fix it is what I described.

      In case it's not absolutely clear, THIS BLOG POST FROM JANUARY 2017 IS MY PERSONAL EXPERIENCE, ON MY 2013 VINTAGE INTEL NUC, INSTALLING A VERSION OF UBUNTU THAT'S LONG BEEN OBSOLETE. But yeah, please go on and make snide remarks about why I couldn't easily Google and include information that was published months or years AFTER my blog post. For crying out loud...

  76. Tuesday, 12 May 2020 18:45
    Couldn't Linux install / update the existing UEFI by installing GRUB2 to the Windows drive during installation, then if the external drive is connected and selected during a boot, you're good.
    If removable Linux is selected during boot but the removable drive isn't physically connected I would expect to get an error, but no biggie....  Just boot Windows or go find the USB drive and cable.......
    1. Tuesday, 12 May 2020 19:18
      That's one of the two reasons my instructions above tell you to create an EFI partition in the external drive and install GRUB2 on it. I don't want you to go hunting for that drive.
      The other reason is that I set out to create a portable installation, meaning that I wanted this to boot on any computer, not just the computer I used to install it. I have successfully used my removable SSD to boot the same Linux installation on five different computers over the last 2 ½ years 🙃
  77. Thursday, 14 May 2020 23:30
    So I was successful in that I was able to create the removable install of Linux on a USB3.0 1TB drive that boots selectively by pressing F12 at boot time, or otherwise the Laptop boots directly to Windows so, success there...
    I did run into a glitch where it initially worked, but after a shutdown it wouldn't boot.  When I went back in and looked at gParted, the efi partition was missing.  I simply re-created it and edited the fstab on the installed root partition to update the new UUID of the efi partition.  I did not:
    mount /dev/sdXZ /mnt/boot/efi
    for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/$i; done
    cp /etc/resolv.conf /mnt/etc/ 
    nor did I:
    sudo chroot /mnt
    grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdX
    but it was working fine, survived shutdowns and reboots so happiness set in.
    Trying to bring that portable installation to my Tower PC though, but it won't boot, was wondering if you had a guess as to why that may be ?  The motherboard Gigabyte x99-ud3p rev 1.0  BIOS ver F23 which is only 3 years old.  Tried to update it but that's not working for whatever reason.
    I will say that on my TowerPC, the selecive boot option is simply listed 'Toshiba3.0 drive' but on the laptop where it works fine, the selective listing simply states Ubuntu...
    Great post, over my head for sure but very interested it getting it to work....
    1. Friday, 15 May 2020 08:10

      The problem is in what you did when your EFI partition disappeared.

      Since you never run the grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdX command your EFI partition does not have the boot loader in the fallback path. Therefore it only boots on the same device it was created on.

      1. Boot into Ubuntu first.
      2. Become root, i.e. sudo su
      3. Run the grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdX command where /dev/sdX is the device for your external hard drive.

      This will install the additional files required to make your drive bootable everywhere.

  78. Sunday, 17 May 2020 00:35

    It works perfect.


    Interestingly enough, I performed this entire task on a laptop with an Intel graphics card.

    Also coincidentally did a clean install of the exact same distro and version on my tower which happens to have a Nvidia graphics card.


    My portable drive boots on either machine, no issues whatsoever.   No password required after booting, everything works fine.


    My clean install on the PC though, because of the Nvidia video card which causes havoc not unfamiliar to Linux users wheres it interferes with launching the desktop environment, especially if you want to boot into Linux without entering the user password...  You end up in an endless logon loop and are forced to workaround it..


    Question is, how can that be.   


    I will be looking for a way to install intel graphics drivers on that machine but, great post.


    Thanks for the time and effort....... 

    1. Sunday, 17 May 2020 07:33

      It's been a while since I had an Nvidia graphics card. I can't tell you within any degree of certainty what is going on but I'd suspect that you're using the closed source Nvidia drivers. Have you tried using the open source ones? They work great unless you do heavy gaming. In the latter case you shouldn't be using a portable installation anyway :)

      FWIW you don't need to install Intel integrated graphics drivers. They are included in the Linux kernel since several years ago. Just booting your installation on a computer with a supported CPU – basically anything released this side of 2012 – will load the required kernel module.

  79. Monday, 18 May 2020 01:58

    I tried a few, but didn't work so I just suck it up and enter my password after boot and all is well on that machine.

    I just think it's crazy (funny) that the fully portable device boots on the machine that has the Nvidia card and all the issues you would expect to occur; do not, yet the installed version which I assume detected and installed the Nvidia drivers during the install is all twitchy.....

    At the end of the day, on the two machines I have here, it worked and works.  

    I'm also assuming that because I performed all the tasks related to creating the portable install on a laptop with Intel GPU that the portable install has Intel or something comparable, anything other than Nvidia drivers installed, and they just happen to work with my desktop Nvidia card ?   Maybe ?    


    1. Tuesday, 19 May 2020 10:02

      Most Intel CPUs released over the last decade or so have integrated graphics so it makes sense that a Linux installation set up without a specific graphics driver will boot just fine. As I said, the Intel graphics driver is part of the kernel and it's loaded at boot if it's relevant i.e. if you have an Intel CPU with integrated graphics. Even if you set up your portable installation on an AMD CPU it'd boot on machines with an Intel CPU and have graphics. Modules are loaded conditionally on boot as long as they're included in the initial RAM disk (typically called initrd.gz).

      Speaking of which, I had some trouble with the initial ramdisk and Ubuntu 20.04 on my old but trusted Intel NUC with an old processor (mid-2013 vintage). Apparently Ubuntu switched its initial ramdisk compression from gzip to LZ4 and it stopped working on my machine. I had to edit /etc/initramfs-tools/initramfs.conf and set COMPRESS=gzip, then run sudo update-initramfs -u -k all to regenerate my initial ramdisk. If you get an immediate boot failure i.e. your kernel doesn't even load then this is something you might need to do. Apparently LZ4 initial ramdisk compression is a bit of a hit and miss?

  80. Saturday, 06 June 2020 17:29

    I had the idea of cloning the portable installation to another drive, retaining the customization on that install to the clone.  The clone drive was smaller so:

    I partitioned EFI and SWAP normally, made smaller / and /home partitions and then copied all files and folders from / and /home to the clone.

    Edited fstab to the correct UUIDs for all, i.e EFI, SWAP, / and /home and basically followed every step just it doesn't show up as a boot option.

    Tried in chroot to grub-mkconfig -o /boot/grub/grub.cfg first, then your command grub-install -d /usr/lib/grub/x86_64-efi --efi-directory=/boot/efi/ --removable /dev/sdX but no luck.

    Scratching my head.

    1. Saturday, 06 June 2020 17:38

      then copied all files and folders from / and /home to the clone.

      How did you copy the files? Did you use a passthrough tar or another method that preserves ownership, permissions and any extended attributes? Or did you just use cp?

      Edited fstab to the correct UUIDs for all,

      Did you also change the UUIDs in the /etc/grub.d files (if present) and /etc/initramfs-tools/conf.d/resume? You'll also need to run mkinitramfs before reinstalling GRUB2 if I recall correctly.

      I don't remember doing anything different about 3 months ago when I did the same.

  81. Saturday, 06 June 2020 17:54

    I'm in over my head, and I figured as much.


    May try installing on top of the partitions I've created but preserving the /home directory in the process.  Continue like a fresh install repeating the steps above.


    Thanks & Cheers....

  82. Sunday, 07 June 2020 01:25

    I did the clone by using tune2fs to mimic the previous UUIDs,  cp -rp to move everything.  dd to clone the efi partition and edited fstab for the new swap UUID 


    Did it more as a learning tool, and it works....

  83. Thursday, 18 June 2020 22:42

    I did manage to install Ubuntu on external hard drive, but as you've posted the Grub is installed on my main internal hd. I'm still able to access windows 10 (using it to type this rn) through the boot menu (pressing f12) and choosing Windows Boot Manager instead of "ubuntu" and also changing the boot order. So i think dont need the recovery windows usb. Should i proceed with the "Fix windows 10 boot"? I don't mean to bother, just afraid to mess my Windows up.

  84. Monday, 30 November 2020 17:54

    Hello and thanks for these instructions, they really paved the way to me using Linux as my main OS.

    I am actually curious if there is a way to dual boot on multiple computers. Specifically, I have a PC and a laptop that where I now now use Linux more frequently. The ability to just take the USB from one system and run it on the other (and potentially any other PC) is what makes it useful for me. The problem I have seen so far with GRUB is that you would need to assign the Windows Boot Manager partition on fstab for both PCs (or simply remove the USB every time you want to boot to Windows). Is there a way to automatically find the Windows boot partition instead of specifically assigning it?

    As for the section F, you can avoid that by installing Linux inside a VM. I used both VMWare Workstation Player and VirtualBox to do that and it worked like a charm. I basically set up the VM to expect a Windows installation (not sure if that is necessary though), then boot with the ISO file for the Linux distro, connect the USB to the VM guest and in the process make sure to select a partition on the USB stick to contain the bootloader. This way you don't mess with your Windows installation if you don't want to. As a side effect, it seems that if you choose to boot from the USB stick, it loads the Linux installation directly without giving you the option to boot into Windows, but it also removes the other options you usually have with GRUB, so you may want to install it, though you don't need to chroot.

    1. Monday, 30 November 2020 19:03

      I can tell you that using the instructions in this article I've created a bootable USB-attached SSD which I've used with four different computers. I didn't have to do anything special.

      Regarding GRUB and the Windows Boot Manager, my advice is to NOT use GRUB to boot into Windows. It's incompatible with BitLocker, the full disk encryption used by Windows 10 Professional and higher. If you make that mistake your computer will boot into BitLocker's recovery. Moreover, as you noted, it's not a very portable or convenient way when you are switching computers.

      Besides, GRUB will auto-detect all EFI boot partitions present on the system and include them in the boot menu by default. It's part of the default GRUB configuration on Debian-based distributions. If you're using a different bistro I have no idea. All I can tell you is that I never add any EFI volume in my fstab besides Linux'. I am not even adding my Windows partitions since they're all encrypted with BitLocker, making them inaccessible to Linux.

      The best thing you can do is enter your computer's boot disk selection. With most computers it's holding F9, F10 or ESC during boot. If you're not sure consult with your computer / motherboard manufacturer. You can select which drive / partition to boot. Windows Boot Manager will take you to Windows. Your external device appears under a different name or not at all, depending on whether you followed my instructions (which you didn't as we're about to see).

      Regarding section F, using a VM is far from being straightforward for most people. It also has some repercussions which might not be self-evident. You are essentially lying to the installer about your computer. It sees less memory, different hardware etc. Usually this doesn't cause a lot of problems. Modern distributions have excellent hardware auto-detection. Still, it's a bit iffy if you ask me. Definitely not something I would recommend.

      As for the need to chroot, you are wrong. It has nothing to do with whether you used a VM, disconnected your Windows boot drive or disabled the Windows boot drive from UEFI. It has to do with making your USB drive bootable across different devices. I EXPLICITLY say so in the article:

      all the instructions you find on-line assume you are using a dual boot system with Windows or macOS. When you have an external drive it is critical that you use the --removable option in the last step. This installs the EFI bootloader under the special "fallback path" EFI\Boot\bootx64.efi in the ESP. Normally this not supposed to be used for permanently installed Operating Systems. It's the mechanism used by EFI BIOS to boot arbitrary external media. Technically, that's exactly what our external hard drive is: arbitrary external media! 

      If you didn't follow that part of the instructions you may have trouble booting into your Linux USB drive on other computers. Specifically, you may have to add them to Windows Boot Manager which kinda beats the purpose of having an installation that you can boot from even if your main drive is dead or you're using someone else's computer.

      1. Monday, 30 November 2020 21:58

        I really appreciate the in-depth reply, especially the part about booting into Windows. While I use Win 10 Pro on my desktop, I think I am not using BitLocker (at least not intentionally), so I haven't really encountered the issue you noted. At first I followed your instructions on my laptop which is running Win 10 Home. But I could be wrong, I remember GRUB giving an option to use Windows Boot Manager to boot to Windows, not just straight up boot by itself, though I could be wrong. Would that solve the issue of BitLocker?

        With regards to booting on other computers, so far it has been working fine between my laptop and desktop. Usually all it takes is to switch the boot priority to removable/USB devices. I have to say that this way, I get absolutely no boot options, so no recovery mode, etc, unless that is something that can be changed.

        I do have to say that on my desktop I noticed a weird hang while using Pop! OS which was not present on my laptop (note that the desktop has by far superior hardware), though even with Windows I notice some weird behavior... Basically something stops responding, making the whole system frustrating to unusable. Not even the terminal responds, nor force shutdown commands. Now I am looking how it is with Kubuntu, and so far no issue. The other annoying thing is that every time I shutdown my desktop, it reboots itself back into Linux, until I either force it to boot to windows and shutdown from there, or press the power button until it shuts down (neither of which are good solutions). On the laptop it shuts down normally.

      2. Monday, 30 November 2020 22:03

        I forgot to clarify, that by "no need to chroot" I meant that since you can boot properly into that Linux installation you should be able to perform the same operations to install GRUB without first chroot from another linux installtion/live disk.

      3. Tuesday, 01 December 2020 09:23

        Windows 10 Home does not have BitLocker. It's a Win10 Pro and Enterprise feature. That's why you could use GRUB to boot into Windows. Even if you have BitLocker GRUB will find the Windows 10 EFI partition and add a Windows boot entry. Selecting it boots Windows... which promptly detects it wasn't a clean boot, clams BitLocker shut and shows you the BitLocker recovery screen. This is how things should work. It's not a bug, it's a Windows 10 feature. It prevents any weird fuckery which could compromise the integrity of your system. Hence, the only way to boot Windows 10 Professional or Enterprise is using your motherboard's boot selection screen.

        I currently have a ~3 year old old Asus laptop (I traded it for my old Mac mini) as my Windows 10 / Linux device. By default, it boots into the attached USB disk. I have to hold down ESC, its boot selection key, when powering up to select the Windows drive when the USB drive is attached. If I forget and get to the GRUB screen I know it's too late and I have to CTRL-ALT-DEL my way out of it.

        GRUB boot options are defined by the GRUB configuration. I can tell you that Kubuntu offers the latest kernel, the previous kernel, single user recovery mode and any third party EFI boot drives detected when installing GRUB. I have not used Pop! OS and I don't think I ever will because it's very militant about not using blobs (closed source drivers). I know that my WiFi and BlueTooth wouldn't work and connecting an external display wouldn't work either. They all require drivers with blobs. I am mostly using the laptop connected to a big monitor so that would be silly. Also, I am a KDE fan ever since my first actually working Linux installation, Mandrake Linux back in 2001. 

        Regarding shutdown, that's weird. Shutdown and reboot send different ACPI commands to your system. You probably need to check if your desktop motherboard requires something special to make ACPI work on it correctly under Linux. If you can't fix it and it just reboots, get to the GRUB page, press the down array so the timeout doesn't go off and then shutdown by holding the power button. At this point no OS is loaded, the disk is not in use and you can safely kill the power.

  85. Tuesday, 01 December 2020 14:22

    I suspect something has changed with Pop! OS since they now have options to install it with proprietary nvidia driver support. On my laptop I didn't have particular issues, but when I booted on the desktop it was missing the PCI-E WiFi driver, which is the same issue with any linux distro, but I could solve same way I did with Kubuntu, ie either take the USB to my laptop and install the driver there then back to the desktop, or use a VM from the Windows installation.

    With regards to GRUB options, I haven't really done anything post installation, so I think it just sees the system as only having Linux. In this way that I installed Linux (through a VM with no other OS in the VM), it just straight up boots into whatever Linux distro I use without any boot options (I only see them if I press Esc). Probably I should get that fixed at some point.

    As for the shutdown issue, I disabled "Power On By PCI-E/PCI" and now it shuts down normally, though I can't use WoL anymore. Then again, I only need that to work when I'm away travelling and I take the Linux stick with me, so it's not a big loss right now.

  86. Monday, 03 May 2021 09:54

    Hi Nicholas

    Thanks to your excellent article I have been able to make a number of full installations of Ubuntu on USB HDDs and run them on various machines over the past years.

    Although the installations run well I encounter problems during installation:

    1. When editing the /etc/fstab file there should be a line with /boot/efi already in it. This line is missing, so I don't comment anything with # but just add:
    UUID= .............  /boot/efi  vfat  defaults  0  1

    2. When I come to sudo mount /dev/sdXZ /mnt/boot/efi there is no /efi in /boot and I have to make the /efi directory first before executing this command.

    • to produce the external Ubuntu HDD I'm using a LENOVO ThinkCentre M600 with nothing on its internal HDD
    • during installation I chose the external HDD in general (not a specific partition) for the installation of the boot loader
    • the partitions /, esp and /home are primary partitions
    • for / and /home the file system is ext4
    • for esp (/dev/sdXZ) the file system is fat32

    In the end I do have a bootable HDD but I would like to know what exactly is going wrong here?

    Thank you,

    1. Monday, 03 May 2021 10:21

      Both issues seem to have the same root cause.

      It would appear that when you are doing the initial installation it's not installed for booting in EFI mode (it boots using the legacy MBR mode). As a result it doesn't create or mount an EFI partition.

      My instructions were written on the assumption that the initial Linux installation is in EFI boot mode. Essentially we're tweaking an EFI booting Linux installation so it can boot on any computer instead of just the one we installed it on.

      1. Monday, 03 May 2021 16:07

        Thank you for your fast reply.

        It is dawning on me what could have gone wrong. Therefor in order to check if I'm on the right track here, I'm asking you the following question:

        Is it possible to do what you have described in your article with a Ubuntu 32-bit PC (i386) desktop image?

        Or asked the other way round: Is using a Ubuntu 64-bit PC (AMD64) desktop image mandatory in order to achieve the desired result?

        Thank you for your help,

      2. Monday, 03 May 2021 16:57

        I haven't used a 32-bit bistro image in the past ten years so I wouldn't know :) I can tell you, though, that the majority of 32-bit mainboards didn't have UEFI firmware so it's very likely that the distribution you are using goes with MBR as a reasonable default.

      3. Wednesday, 05 May 2021 21:22

        Ok, so now I'm using Ubuntu-18.04.4-desktop-amd64.iso.

        While installing Ubuntu regularly, and when prompted about the disk layout I chose "something else", according to your article. I created a / partition (ext4), a swap partition and a /home partition (ext4), all primary. When I click "install now" a warning pops up:

        "No EFI system partition was found. This system will likely not be able to boot successfully, and the installation process may fail.
        Please go back and add an EFI system partition or continue at your own risk."

        I can't find any comment on this in your article. What do you recommend?

      4. Wednesday, 05 May 2021 21:38

        My machines already had an EFI partition (for the main OS) so I didn't have to create one. Since yours does not have an EFI partition create on during the installation of Ubuntu. 

        When setting up the partitions the first partition you create needs to be 100MB at the beginning of the disk, Primary, and Use as should be set to EFI System Partition. Then proceed with the rest of the partitions as discussed in the article.

        This of course means that you will skip over the step of creating an EFI partition later on since you already have it. You will only need to reinstall GRUB2 so that your external drive boots on any device you plug it in.

  87. Wednesday, 05 May 2021 23:57

    No more problems during installation. The new external drive boots perfectly. So far I tested it on 3 machines.
    Thank you for your help and for making this procedure so clear and obvious.

    1. Thursday, 06 May 2021 22:19

      I am glad we were able to help you solve this! Have a great day :)