How to create a live USB drive with persistent storage in Ubuntu

Having a version of desktop Linux on a USB drive isn't very useful unless you can store files to it. Now you can with the mkusb tool.

How to create a live USB drive with persistent storage in Ubuntu

When you flash a bootable, live ISO Ubuntu image to a USB drive, you can carry it with you and boot up Linux wherever you go. The problem is that you cannot store files on a standard live drive. In order to save files to that drive, you must create it with persistent storage.

Persistent storage is exactly what it sounds like, a portion of the flash drive dedicated to storage. Without persistent storage, any files you've saved to the drive will be purged upon rebooting with the live instance.

I want to walk you through the process of creating a live USB flash drive with persistent storage. This will only work with Ubuntu and Ubuntu derivatives, so make sure you download a supported ISO image for your distribution of choice. I'll demonstrate the steps for installing Ubuntu Desktop 18.04 on a USB flash drive from Pop!_OS.

SEE: BYOD (bring-your-own-device) policy (Tech Pro Research)

With that said, let's get to work.

What you need

  • The mkusb tool.
  • An ISO image of Ubuntu Desktop or a derivative.
  • A flash drive with a minimum of 8GB of storage.
  • A user account with sudo privileges.

Installing mkusb

The first thing to do is install mkusb. Log into your Linux desktop machine and open a terminal window. From the terminal, issue the following commands:

sudo add-apt-repository ppa:mkusb/ppa
sudo apt update
sudo apt install --install-recommends mkusb mkusb-nox usb-pack-efi 

When the installation completes, you should see the mkusb tool in your desktop menu. Start it up, and we're ready to go.

Flashing the image

When you first run mkusb, you will be asked if you want to run the dbus version of the tool (Figure A). Click Yes.

Figure A

Figure A: The first window of the mkusb tool.

You will then be prompted for your user's sudo password. This window will also be accompanied by a terminal window. Do not close the terminal window (throughout the entire process), as it is required to be open during the run of mkusb. Type the password and hit OK. The next window is just a warning, indicating that your target device will be completely overwritten. Click OK to continue.

In the resulting window (Figure B), select Install (make a boot device) and click OK.

Figure B

Figure B: Instructing mkusb what we're doing.

Now we come to the portion of the installation that allows us to instruct mkusb to add persistent storage to the flash drive (Figure C). Select 'Persistent live' --only Debian and Ubuntu and click OK.

Figure C

Figure C: Make sure to select the Persistent option.

You will then be required to select the ISO image for installation. Once you do that, click OK. If you have multiple USB drives available, you'll be asked to select the target drive for the persistent storage. Make sure to select the correct drive for this (otherwise you risk overwriting a drive housing actual data).

Once you select the target for persistent storage, you can then select any options required for the drive (Figure D).

Figure D

Figure D: Selecting our drive options.

For most instances, you'll want to select upefi, which enables the GRUB bootloader to work in both UEFI and BIOS modes. Click OK and then, when prompted, select the size you want for persistent storage (Figure E). Move the slider to the percentage of freespace you want to use and click OK.

Figure E

Figure E: Setting the size of persistent storage.

In the final screen (Figure F), review your settings, select Go, and click Go. This begins the process of writing the ISO image to the flash drive, complete with persistent storage.

Figure F

Figure F: Ready, steady, go!

When the process completes. Remove your USB drive, and you're ready to carry with you a version of Ubuntu Desktop Linux, complete with persistent storage. You can save files to that live instance, knowing it will still be there when you next boot up the drive.

Congratulations, you now have a live, instance of Ubuntu Desktop Linux that you can take anywhere, all the while retaining any files you saved to the drive.

Also see

Image: Jack Wallen