Geek Stuff Linux Tutorials

How to Create a Persistent Ubuntu USB

Written by Vivek

When you create a bootable Linux or Ubuntu USB, it lets you access a live session of the OS apart from allowing you to install the OS on your system. This is really useful when you want to do something and don’t have an operating system installed on your PC. This is also helpful if your PC refuses to boot. There can be many other similar situations, but this live session has one problem. Everytime you boot, it’s a blank slate. You can install programs, make changes to the OS, customize it, but as soon as you shut down, all the changes are lost. This is good for most people, but if you want a system that picks up where you left off, you can create a persistent Ubuntu USB.

What is a persistent Ubuntu USB

It’s a bootable Ubuntu USB but with persistent storage. As the name suggests, the user data from the live session is persistent, i.e., it does not disappear after reboot. This is done via a persistent overlay file which stores all the information about the changes. Any programs you install, the settings you change, are all written to this file. You’ll have to allocate a part of your USB storage to this persistent file. You can theme the system, but you cannot change any system files such as the kernel. You won’t be able to install major system upgrades, such as an update from Ubuntu 17.04 or 17.10 to 18.04. Additional hardware drivers also cannot be installed.

Other than that you can do pretty much everything else. You can install programs, update them, save your files, customize your OS, it’s pretty much like carrying your OS on your USB. All you need is the hardware to boot it up and use it. This can be anyone else’s computer or other computers you may have around. You won’t have to start from scratch each time you boot your Ubuntu live session. Persistence does not work with all Linux distributions but it does work with Ubuntu and Ubuntu based systems.

Must read: How to Enable Flatpak Support in Ubuntu

How to create a persistent Ubuntu USB

To create a persistent Ubuntu USB, you will need the mkusb tool which is easy to install if you’ve installed programs on Ubuntu before. You’ll need to do this via the official ppa using the terminal. Before you can do this though you’ll also need to enable the universe repository for your Ubuntu system if you haven’t already. You can do this via the graphical interface but simply pasting the command below in a terminal would be much easier.

sudo add-apt-repository universe
  • To install mkusb, enter the following commands one by one.
    sudo add-apt-repository ppa:mkusb/ppa
    sudo apt-get update (Ubuntu 18.04 users can skip this step)
    sudo apt-get install mkusb

    This will install the GUI version of mkusb.

  • Run the tool via the Terminal using this command.
    sudo -H mkusb /path/to/iso/filename.iso p
    Replace /path/to/iso/filename.iso with the path to the Ubuntu ISO file and the correct file name. For instance, sudo -H mkusb ubuntu-18.04-desktop-i386.iso p
  • You’ll be provided with a list of options, type e and hit enter. How To Create A Persistent Ubuntu USB
  • In the new window that opens up, click on Select target device:How To Create A Persistent Ubuntu USB
  • Click on the USB drive that you want to install the Ubuntu ISO to with persistent storage and click OKHow To Create A Persistent Ubuntu USB
  • Make sure you have selected the right drive because the process will wipe all the data on the drive. When you’re ready, check the checkbox as shown below and click GoHow To Create A Persistent Ubuntu USB
  • In the dialogue box that appears next, select Quit from this menu. This will let mkusb choose the default option. How To Create A Persistent Ubuntu USB
  • Next, select the percentage of storage you want to allocate for persistence. If you have enough space on your USB like I had with a 32GB USB, 20 would be a good number to enter here. How To Create A Persistent Ubuntu USB
  • The process can take a few minutes, but if everything goes well, you’ll see something like the window below with a message, click OKHow To Create A Persistent Ubuntu USB

You can now remove the USB and use it to boot on any available computer. You’ll find that any of the changes you make are saved and still there on the next boot.

You may also like: How to Enable Click to Minimize on Ubuntu 18.04