DEV Community

Cover image for Running Ubuntu From A USB Drive
Angela Whisnant
Angela Whisnant

Posted on

Running Ubuntu From A USB Drive

Hey, guys! I had quite the adventure today trying to run Ubuntu on my son's laptop from a flash drive, so I thought I would share what I learned here in case some of you would like to try it.
The laptop I am presently using for coding classes is an Asus ROG Gaming Laptop. It has an Intel i7 processor, 16 gb of ram, and a 1TB HDD. There are still over 250 gb of space left, so, theoretically, I could run Ubuntu on this machine as a dual boot with the current Windows 10 OS, but that would require me to partition the drive, which I haven't tried before, so I decided that, since this isn't my computer, I'd go for the less invasive option.

The steps for making this happen are as follows:

  1. Download Ubuntu
  2. Download Rufus and create a bootable drive.
  3. Edit Power Button Settings in Windows Control Panel
  4. Copy Ubuntu to flash drive.
  5. Edit System Bios
  6. Run Ubuntu

Download Unbuntu Depending on your system and network, this can take from 30-45 minutes.

Next, Download Rufus. You will use Rufus to create your bootable USB drive. I found these instructions from Ubuntu's website very helpful. Follow them to create your bootable drive.

Next, you'll need to change the settings for your power button. Make sure you complete this step before you alter the system Bios.

Once Ubuntu download is complete, you'll need to alter your system bios to boot from your USB drive first and Windows OS 2nd. To do this in Windows 10 is much more complicated than it once was in previous Windows Versions.
You will have to go to the settings tab to accomplish this.

Select Settings at the Windows menu
Select Update & security.
Select Recovery from the left menu.
Click Restart Now under Advanced startup. ...
Click Troubleshoot.
Click Advanced options.
Select UEFI Firmware Settings. ...
Click Restart.

Your computer should now boot to the Bios. Make sure the flash drive is plugged in when the Bios comes up. Different Bios can operate in various ways but on my system, I was able to choose the Boot tab and change the boot order of the computer. So now this laptop will boot from the USB drive first, then the C: drive, where Windows 10 OS lives.

Now, Restart your computer with the USB drive. The Ubuntu menu will load. Choose 'Try Ubuntu without Installing.' A usable version of Ubuntu will load!

Fantastic! I am finally using Ubuntu and am loving how fast it is. Many of you recommended it in this post and now I know why. I have downloaded Visual Studio and am ready to go!

Top comments (8)

Collapse
 
geraldew profile image
geraldew • Edited

Just a quick thumbs up from me - as I've been operating my Ubuntu setup that way for many years (from at least 12.04 LTS if not longer).

However I don't use a flash drive - instead I use a portable hard drive, which these days mean USB3. While this is mostly about capacity, where I did use flash drives I found they didn't last as they're really not made for frequent data rewriting long term.

At some point you may have an epiphany when you realise that your USB drive now "is" your computer, and the computer is now the dumb piece of commodity hardware. As a bonus, the hard drive is much more portable.

The one big catch however - and you clearly already found this - is that you need to learn how to "get into" the boot sequence of any computer you go to use. In general, each different make+model is .. different.

A related catch is about the alternative booting schemes - MBR versus EFI. At this point, I'm still finding it more reliable to use MBR boot on my external drive, as the Ubuntu update process for EFI defaults to updating EFI on the host machine instead of the external drive. In 2019 this seems a dumb choice to be making but I haven't yet found a good enough work around.

FWIW - I prefer to find which method does not require making a permanent change on the machine - and yes, even on my main machine I tolerate doing the couple of steps to divert the boot on every power up. But another good method is to install REFInd - en.wikipedia.org/wiki/REFInd - there are quite a few options for boot managers around. After years mucking about with those, seeing the external drive as "the computer" led me to stop bothering.

p.s.in case it's not obvious, having a full hard drive - e.g. 1TB - means I do a "full install" onto it, not just the downloaded boot image.

Collapse
 
geraldew profile image
geraldew

A very belated follow-up, but I finally got around to writing up how I now make these setups for 64bit GPT EFI computers. See dev.to/geraldew/ubuntu-linux-insta...

Collapse
 
angelarae63 profile image
Angela Whisnant

Mind blown! Why didn’t I think of that!? I’m gonna look into getting an external hard drive. What a great idea!

Collapse
 
geraldew profile image
geraldew

A very belated addendum is that I've since cracked the solution to correctly setting these up to work with EFI booting. The magic ingredient is using grub-install with a --removable option.

I should probably do a full post to cover this sometime but for just here I'll quote the sources for the magic tip:

In my case I cheated by unplugging the internal hard drive of my laptop and then installed Ubuntu 20.04 onto a USB thumb drive from a DVD (of the ISO live disc for AMD64). Then after a successful boot on the thumb drive I went to the command line to-reinstall GRUB with the removable option. That thumb drive now boots fine on any of 64bit computers and - importantly - when it does so it uses the ESP partition on itself, leaving any other drive safely alone.

The other extra trick is to use efibootmgr to alter the EFI default order - but that's a whole other topic and can't override bad firmware behaviours.

Collapse
 
flrnd profile image
Florian Rand • Edited

Congats and Happy Coding!

Since you are having fun howto create a persistente bootable Ubuntu USB Flash Drive.

This way you can use your son's laptop and store your things without messing with his πŸ˜…

Collapse
 
angelarae63 profile image
Angela Whisnant

Cool! But the link isn’t working...

Collapse
 
flrnd profile image
Florian Rand

haha indeed! Sorry wrong link! try again ;)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.