OS: Windows 7. I want install Linux Ubuntu on portable external Hard Drive USB 2.0. I read a variety of methods, but I'm confused by contradictory advices and methods. Actually, installing Ubuntu on anything other than clean PC looks much more complicated than installing Windows. I need to have Ubuntu package + Python 2.7 + C compiler installed. My external hard drive is partially filled, I need to keep all files.

Will Ubuntu run entirely on external hardrive, without writing anythinhg to Windows system folders and to registry?

Can anyone post detailed guide how install Ubuntu on external hard drive?

  • What are your machine specs? How much room do you have on the usb hd? Does your chip have vt-x? I can give you the steps for an actual install, but since your Ubuntu needs are minimal, a virtual machine may be best for you. Of course, installing a VM writes to the registry, etc. Is this your own computer or work?
    – chaskes
    Commented Apr 12, 2014 at 1:09
  • Its my laptop. Intel Core 2 Duo CPU T6670, RAM 3GB. Not sure for vt-x. External hard drive 386GB free. VMware Player or VMware workstation? Probably Live CD will fit, but I need custom one with above packages + Binwalk with dependencies.
    – Lexx Luxx
    Commented Apr 12, 2014 at 1:45
  • You have vt-x . You need to go into bios and make sure it's enabled. You'll be fine with a VM in VMWare Player, which is free (workstation is$ 250). Give 1024 MB ram to VM (you could even get by with 768). Your needs don't require a lot of space
    – chaskes
    Commented Apr 12, 2014 at 1:50
  • What's advantages & disadvantages to run Linux on VMWare Player vs running Linux from an external hard drive?
    – Lexx Luxx
    Commented Apr 12, 2014 at 12:31
  • Both solutions are easy and would work for your needs. Using VMWare Player first might be better for a beginner, especially if you have a proprietary graphics card. You could move to a full install later.
    – chaskes
    Commented Apr 14, 2014 at 14:56

6 Answers 6


A very detailed answer would be beyond the scope of a single question, but here's the general outline. It's very easy, but success will partly depend on the ability of your computer to boot from an external hard drive. This depends on the bios.

Before starting, make sure your bios has an option to boot from a USB HD.

If all you need is the basic install, Python 2.7, and the C compiler, you can get away with installing Ubuntu to a fairly small partition. I forget the literal minimum Ubuntu needs to install, but it's roughly 8 GB. I would recommend 10 GB as a minimum, plus another 2-4 GB if you want a swap drive.

Create space for a partition

It's best in your case to create the new partition before doing the install. You will need to shrink the existing partition on your external hard drive first.

I would recommend backing up the USB HD; but if you had a second one, you could just install to that one. Depending on how full the drive is, you may not be able to back it completely; but try at least back up any important files. This is just a general warning and precaution since your data should be safe.

You have two options to shrink the existing partition:

  1. Use the Windows partition manager in administrative tools. I believe these are available in Home Premium. If the partition won't shrink by enough, you may need to delete files to make room. If you have more than enough available but it still doesn't shrink enough, use a free defrag tool like MyDefrag to defrag and move the files to the start of the partition.

  2. Use gparted from the Ubuntu live install media. This is probably the easier way to do it.

Create a new partition

Create the Ubuntu live installation media and use it to boot your computer. Choose Try Ubuntu.

Plug in the external hard drive. Start the program gparted. If you have not already shrunk the partition on the external HD, do it now.

In most cases, the internal HD will show up as sda and the external as sdb, but this is not guaranteed. Be sure you are looking at the correct HD in gparted.

Shrinking the partition will leave unallocated space. Use this to create a new partition. Format it to ext4. Jot down the partition number. This will be used for /.

You don't need a swap partition, but if want one, shrink the new partition by the size you want (or just make it a little smaller in the first place). Format that space to linux-swap.

Note down the numbers of the new partitions.

Run the Installer

Start the installer from the icon on the desktop or on the launcher. When asked how you want to install, choose: Somethine Else.

This will start the partitioner within the installer. This is different than gparted and may look a little intimidating to a beginner.

Carefully highlight the new partition (check the number and drive carefully) and click Change.

Follow the dialogs to a. Use the partition as ext4, b. mount to /, and c. format.

Highlight the swap partition and click Change. Choose use a linux-swap and that's all for that one.

Very important: change the installation of the bootloader to the USB HD. This will most likely be /dev/sdb. This will prevent you from overwriting the master boot record on your hard drive. (If you do this by accident, it's easily fixed).

Double-check your partition choices, then click Install Now.

That's it. To run Ubuntu, boot the computer with the USB plugged in. Set your bios order or otherwise move USB HD to the first boot position. The boot menu on the usb will show you both Ubuntu (on the external drive) and Windows (on the internal drive). Choose the one you want. If you boot without the usb, you will boot into Windows normally.

Ubuntu has Python 2.7 installed by default. To install the C comiler, open the terminal, any run:

sudo apt-get install gcc


sudo apt-get install build-essential

(if you want some additional programs helpful for C programming).

To run Ubuntu in a virtual machine instead, install VirtualBox or VMWarePlayer in Windows. Both are free. Create a new VM and use the installer media to install to the VM. But this time, don't worry about partitions. Choose Install Ubuntu to the entire virtual drive. This doesn't affect the rest of the hard drive.

If you want to put the VM on the external hd, be sure to override the default location when creating the VM and put it on a folder on the external drive.

Creating your installation media with persistence through a Windows program like LiveUSBCreator will also work, but this option will be very slow.

  • 2
    The Ubuntu 18.04 installer broke grub on my internal hard drive even though I chose installation of the bootloader to the USB hard drive, as advised in these instructions. I needed to run boot repair to recover. Commented Jun 7, 2018 at 6:12
  • 1
    @CommunicativeAlgebra You can avoid this problem by disconnecting your internal drive before and during the installation process so that the installation of the bootloader can only go on the external drive.
    – mchid
    Commented Jul 2, 2019 at 5:14
  • @mchid How can we disconnect internal drive before and during the installation process? Could you please explain it a bit.
    – Porcupine
    Commented Jun 14, 2020 at 12:22
  • @Nikhil It really depends on what kind of computer you have. In all cases, you should be properly grounded when touching any internal computer part. For a tower computer, you just have to unplug the SATA cable from the drive before you do the installation. You can plug the SATA cable back into the drive sometime after installation. For a laptop, you have to unplug the drive from the computer. Then, plug it back in sometime after installation.
    – mchid
    Commented Jun 15, 2020 at 18:16
  • @Nikhil If a laptop, disconnecting the drive may be more trouble than it is to use bootrepair to recover and it may be easier to use the bootrepair method instead of taking your laptop apart.
    – mchid
    Commented Jun 15, 2020 at 18:19

Ubuntu can, and does, run well entirely from an external hard drive. I have used Ubuntu this way for years. It doesn't affect Windows. There's nothing special about installing to USB drives. You connect the USB drive, boot using a CD or an pen drive, and choose the external disk when it comes to selecting the installation location.


You will have partition the external hard disk. I assume your external disk has a single partition with an NTFS filesystem. The best thing to do is shrink this partition by about 20 GB (which is more than enough for Ubuntu) and create new partitions there. This is not as difficult as it sounds (and you'd have to worry about partitions if you wanted to install another copy of Windows too).

Either use Windows' Disk Management tool to shrink the partition, or use GParted from the Ubuntu Live mode. Using the former is quicker, but limits you to whatever space is available after the last used sector in the partition (which can be very low, even if you have plenty of free space). Using the second can be very slow, especially if the partition is large, but lets you extract most of the free space.

In either case, after you get the free space, use GParted to create an extended partition there and within that extended partition, an ext4 partition. Install Ubuntu to this partition. Choose your external hard disk as the device for GRUB (bootloader) installation as well.


If you have a pendrive handy, use UNetBootin or Universal USB Installer or some such tool to create a bootable Ubuntu drive with persistence. If persistence is enabled, your settings and other changes to Ubuntu that you make when in Live mode don't vanish when you restart. It's ideal for low usage scenarios. You can install Python or anything else and get comfortable with Ubuntu, and then, whenever you feel ready, install Ubuntu. Note that changes made in the live mode do not affect any installation you make with it.

  • 1
    2016, Unetbootin, Universal and other syslinux type installers are not working with 14,04 and later persistent installs. Grub2 type installers that do work for persistent partitions on thumb drives do not seem to be working for USB hard drives, even with casper-rw files or partitions. Commented Dec 7, 2016 at 4:39
  • mkusb, help.ubuntu.com/community/mkusb, can create a persistent live drive in USB hard drives and SSD drives in external boxes with USB or eSATA connections. But the original poster wanted to keep all current files in the target drive, and mkusb will overwrite the partition table and create a new one. So it would not be an option for this case unless those data are backed up to another drive and restored after the persistent live system is installed.
    – sudodus
    Commented May 4, 2017 at 16:25

Full Install to USB

Full installs are more stable and secure than persistent installs, but not as quick to make. They are better at utilizing disk space as no fixed size casper-rw file or partition is required. They are not very good for use of installing Ubuntu.

Following is a step by step how to install 18.04 on a 16GB flash drive with options for separate Home partition and Windows compatible data partition, install to mechanical external drive is similar:

  • Create a live USB or DVD using SDC, UNetbootin, mkusb, etc.
  • Turn off and unplug the computer. (See note at bottom)
  • Unplug the power cable from the hard drive or unplug the hard drive from the laptop.
  • Plug the computer back in.
  • Insert the flash drive.
  • Insert the Live USB or Live DVD.
  • Start the computer, the USB/DVD should boot.
  • Select language.
  • Select install Ubuntu.
  • Select Keyboard layout
  • Select "Continue".
  • Select installation type and "Download updates while installing Ubuntu" and Select "Install third-party software ...", (optional).
  • Select "Continue".
  • At "Installation type" select "Something else". (Full disk encryption is now working with flash drives).
  • Select "Continue".
  • Confirm target device is correct.
  • Select "New Partition Table".
  • Click Continue on the drop down.

(Optional FAT32 data partition for use on Windows machine)

  • Click "Free space" and "+".
  • Make "Size..." about 2000 MB.
  • Select "Primary".
  • Location = "Beginning of this space".
  • "Use as:" = "FAT32 file system".
  • "Mount point" = "/windows".
  • Select "OK"

(Non Optional Root Partition)

  • Click "free space" and then "+".
  • Select "Primary", "Size ..." = 4500 to 6000 MB, "Beginning of this space", Ext4, and Mount point = "/" then OK.

(Optional home partition)

  • Click "free space" and then "+".
  • Select "Primary", "New partition size ..." = 1000 to 6000 MB, Beginning of this space, Ext2, and Mount point = "/home" then OK.

(Optional swap partition, allows hibernation and frees up memory when RAM is full)

  • Click "free space" and then "+".
  • Select "Primary", "New partition size ..." = remaining space, (1000 to 2000 megabytes, or same size as RAM), Beginning of this space and "Use as" = "swap area" then OK.


  • Confirm "Device for boot loader installation" points to the root of the USB drive. Default should be OK if HDD was unplugged.
  • Click "Install Now".

  • Select your location.

  • Select "Continue".
  • Insert your name, computer name, username, password and select if you want to log in automatically or require a password.cscameron
  • Select "Continue".
  • Wait until install is complete.
  • Turn off computer and plug in the HDD.
  • Replace the computer's cover.

Note: You may omit disabling the hard drive if after partitioning you choose to install grub to the root of the USB drive you are installing Ubuntu to, (ie sdb not sdb1). Be cautious, many people have overwritten the HDD MBR as default location for boot loader is sda, any items in the internal drive's grub will be added to the USB's grub. You may do an update-grub later.

  • If I purchase say a 64GB USB drive and do a full install of Ubuntu on to that, I assume: it will allow me to use the whole drive for storage, will be persistent, and I can use that on any PC to boot up to Ubuntu. Is that correct?
    – BruceWayne
    Commented May 19, 2019 at 22:46
  • 1
    @BruceWayne : Correct, the only thing a Persistent install can do that a Full install can't is install Ubuntu. I like to have a FAT32 or NTFS partition that can be used for data on a Windows or Linux computer. The file system partition (/) and home partition, (/home), are on a ext4 partition not visible to windows. Commented May 19, 2019 at 23:53

I don't think this is fully supported via Wubi, but it can be done. I'm not entirely sure of how you plan to use it.

In the past, I've unplugged my Windows device, plugged in my external device, and just run through the install using the external (and in many cases, the only) drive. Ubuntu will install correctly and treat that drive as "a drive" - nothing special being external.

Then, rather than dealing with dual-boot and GRUB, I can just use the BIOS/uEFI options to select my preferred boot device after I reconnect my Windows drive.

There are other ways of doing it, but I've found this to be the easiest, with the absolute minimal risk to my Windows systems.

  • 2
    I dont want open laptop and remove hard drive.
    – Lexx Luxx
    Commented Apr 12, 2014 at 0:42
  • opening the laptop and disconnection the drive is the biggest downside, The process is the best way not to toast your windows install as all other ways using grub introduce conflicts. Using bios to boot works as it loads before windows and so no boot conflicts or windows damage. The drive do not see each other at boot and so no need of grub except on external disk and it only loads when that disk is selected for boot. probably not what I want to do on my new windows machine though as i break warranty by fussing with internal hardware to disconnect internal drive temporarily.
    – lewis
    Commented Jul 6, 2020 at 2:21

Creating a Full Install of Ubuntu 20.04 to USB that works in both BIOS and UEFI

Following is based on a 16GB Target drive, adjust for larger drive. This looks like a long list but, should take less than ten minutes to do the work.

  • Create a Live USB or DVD using SDC, UNetbootin, mkusb, dd, etc. (See Note 1 at bottom)
  • Turn off and unplug the computer.
  • Unplug the power cable from the hard drive or unplug the hard drive from the laptop. (See Note 2 at bottom)
  • Plug the computer back in.
  • Insert and boot the Live USB or Live DVD. (Booting BIOS mode preferred).
  • Select Language and Try Ubuntu.
  • Insert the target flash drive.
  • Start GParted.
  • Unmount any mounted partitions.
  • Select Device tab and create a GPT partition table on the Target drive.
  • Create a 3GB NTFS or FAT32 partition on the right side, (optional Linux / Windows data partition, See Note 3 at bottom).
  • Create a 1MB partition on the left side, format as unformatted.
  • Create a 300MB FAT32 partition next to the 1MB partition.
  • Create a 7GB ext partition next to the 300MB partition.
  • In the remaining space create an ext4 partition, (optional for /home partition).
  • Apply All Operations.
  • Flag the 1MB partition as bios_grub.
  • Flag the 300MB partition as boot,esp.

Image of GParted

  • Start Install Ubuntu.
  • Select Language, click "Continue".
  • Select Keyboard layout, click "Continue".
  • Select Wireless network, click "Continue". (optional).
  • Select installation preference and select "Download updates while installing Ubuntu", (optional), and Select "Install third-party software ...", click "Continue". (Optional).
  • If asked about mounted partitions, select Yes, click "Continue".
  • Do not use Advanced feature disk encryption for this install method. (See Note 3 at bottom).
  • At "Installation type" select "Something else", click "Continue".
  • Under Device for boot loader installation select the target drive.
  • Select partition sdx4 and click change, select use as Ext4, select format this partition, and Mount point = "/" then OK.
  • If asked to Write previous changes... click Continue.
  • Select partition sdx5 and click change, select use as Ext4, select format this partition, and Mount point = "/home" then OK. (optional).
  • Click Install now.

Image of  Something else

  • Confirm partitions to be formatted if asked, click continue.

  • Select your location. click "Continue".

  • Insert your name, computer name, username, password and select if you want to log in automatically or require a password. - Click "Continue".

  • Wait until install is complete.

  • Do not reboot or unplug the target USB.

  • Copy the boot and the EFI folders from the Ubuntu ISO file to the boot,esp partition sdx3.

  • If there any problems with permissions, etc, open Nautilus using sudo -H nautilus and try copying again.

  • Copy grub.cfg from partition sdx4 /boot/grub/ to partition sdx3 /boot/grub/ overwriting the grub.cfg file.

  • Re-Install GRUB:

    sudo mount /dev/sdx3 /mnt
    sudo grub-install --boot-directory=/mnt/boot /dev/sdx

  • Turn off computer and plug in the HDD.

  • Replace the computer's cover.

Note 1, Booting ISO Files.

  • If you want the USB to have the ability to boot ISO files using GRUB, create the boot drive using mkusb with the usb-pack-efi option. (this replaces GRUB 2.04 with 2.02).
  • Alternatively you can put rmmod tpm anywhere above the first menuentry in grub.cfg.

Note 2: Hard drive removal.

  • You may omit disabling the hard drive in BIOS boot if after partitioning you choose to install grub to the root of the USB drive you are installing Ubuntu to, (ie sdx not sdx1). Be cautious, many people have overwritten the HDD MBR as default location for boot loader is sda, any items in the internal drive's grub will be added to the USB's grub. You may do an update-grub later. If you leave the HDD plugged in with UEFI install, fstab may use the HDD's UUID for /boot/efi. In this case # or delete the /boot/efi.UUID line in fstab.

Note 3: Apple compatibility.

  • If you own an Apple computer make this partition FAT32.

Note 4: Encryption (optional).

  • @c-s-cameron Is installing grub into root of sd-card (sdb) is good idea with internal hard disk intact ? Can you boot into hdd without sd card after that ? I for example have ubunru 20.04 on sda1 and ubuntu 22.04 on sda2. But Installed on sda2 later and both time selected sda (not sda1 or sda2) as grub install location. The result is if you change anything in grub menu from sda1 (i.e,loggin into ubuntu 20.04) it won't affect. You have to change it from last install ubuntu and then run grub-update. Isn't that same case with external sd-card ? Commented Jun 29, 2023 at 21:28
  • @Khurshid Alam: See Note 2 above. Commented Jun 30, 2023 at 1:30
  • @c-s-cameron I saw the note. When you are talking about deleting boot/efi from fstab, I am guessing you are talking about fstab from sd-card not hard-disk ? If so, what is to replace it with ? That 300 MB efi partition, created on sd card, needs to be there on fstab to boot from sd-card. I just want to remove additional hard-disk partition from usb's grub. Commented Jun 30, 2023 at 18:32
  • open /etc/ on SD card, open fstab as root. add # at the beginning of the /boot/efi.UUID line. Don't add anything else. I prefer creating Full install USB installs booted from BIOS, not UEFI. Commented Jul 1, 2023 at 12:22

Install Ubuntu from a Pre-built Image File.

This method creates a USB that boots on both BIOS and UEFI computers.

If working in Windows:

The USB drive should boot on almost any modern X86-64 computer.

enter image description here

Thanks to sudodus for the image file.

In Windows it may be necessary to install 7Zip before proceeding. Rufus and Etcher will use it when working with the .xz image: https://www.7-zip.org/a/7z1900-x64.exe

If working in Ubuntu: you can use mkusb, Disks or Etcher to flash the USB drive. If using mkusb, select option "c" Cloning iso file... for flashing the image to disk. P7zip may be needed to extract the .xz image with Disks or Etcher.

  • C.S.Cameron, can you please update the Rufus link to the latest version? The latest is 3.13, not 3.11, and releases 3.12 and 3.13 actually contain important bugfixes related to Ubuntu. Preferably, you may want to point to rufus.ie, as it always contains a link to the latest download as well as localized information about Rufus that OP might be interested in. Or, if you want to point to GitHub, please use github.com/pbatard/rufus/releases as it avoids linking to a version that may be obsolete. Thanks!
    – Akeo
    Commented Mar 18, 2021 at 10:46
  • @Akeo: Yes you are right, besides it is probably better not to have the download link pop right up. People prefer to see what they are downloading. Thanks. Commented Mar 19, 2021 at 1:37
  • Much appreciated. Thanks! (PS: For some reason, whenever I try to @ your name, it gets deleted. Weird...)
    – Akeo
    Commented Mar 19, 2021 at 19:52
  • @Akeo: I think that is because I wrote the answer and every comment made to it goes to me without an "@". same with comments to questions. Commented Mar 20, 2021 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .