Achievable logo
Exam preparation
Lifestyle topics
Achievable blue logo on white background
Achievable blue logo on white background

How to create a live Ubuntu USB drive with persistent storage

Usually, a Linux live USB drive is a blank slate every time it is booted–, after rebooting the drive, changes are wiped away and the system starts anew. This can be rectified by creating a live USB with persistent storage. How does persistent storage work? A USB drive with persistence allows for up to 4GB …

Achievable blue logo on white background
create-live-ubuntu-usb-drive
Achievable blue logo on white background
Achievable blue logo on white background
Achievable SIE - $99
Pass the FINRA SIE on your first try with Achievable's online course. Includes everything you need: easy-to-read online textbook, 2,000+ review quizzes, and 35+ full-length practice exams.
Laptop displaying the Achievable exam prep dashboard and a smartphone displaying a quiz question

Usually, a Linux live USB drive is a blank slate every time it is booted–, after rebooting the drive, changes are wiped away and the system starts anew. This can be rectified by creating a live USB with persistent storage.


macrovector / Freepik / “USB flash drive over white background. Memory transfer technology, storage electronic portable connect device.” / FreePik license

How does persistent storage work?


storyset / Freepik / “Code typing concept illustration” / FreePik license

A USB drive with persistence allows for up to 4GB of the drive to be used for a persistent overlay file. Changes made to the system (such as saving files to the desktop, changing settings for an application, installing a new program) will be stored within the overlay file. When the USB drive is booted, the new files, settings, and programs will be available. It is important to note the changes will appear on any computer, not just the system the original changes were configured on.


This feature is especially useful for users who want to keep a live Linux system on a USB drive and additionally use multiple PCs. It would take an incredible amount of time and effort to set the system up each time it is booted. However, persistence is usually not needed if you use a USB drive to install Ubuntu and then run the application from the hard drive.


Although persistence can be incredibly useful, there are some drawbacks. System files like kernel files cannot be modified. Hardware drivers cannot be installed either. Despite this, most other applications can be installed. Another added benefit of persistence is being able to update most applications. In order to get the most use out of persistence, ensure that the USB drive has the latest version of the preferred web browser.


Be aware that persistence is not compatible with every Linux distribution. For example, persistence works with Ubuntu 24.04 but not 23.04. Persistence should generally work with Ubuntu-based Linux distributions, as well as Fedora Linux. Rufus, an open-source tool, supports persistent storage in the latest versions. Rufus can be useful if using Windows in order to avoid any extra processes. To best ensure success, have the appropriate ISO file and follow the helpful guide below.


Making a persistent Ubuntu USB drive on Ubuntu


storyset / Freepik / “Add files concept illustration” / FreePik license

Two items are needed to begin this venture: a computer that is already running Ubuntu and a USB drive with suitable storage to run persistence. As a general rule, the larger the USB, the more persistent storage it can support.


Running grub, boot, and Ubuntu will only require about 2GB of the USB drive. Other programs, such as casper-rw and usbdata, will take up more space on the drive.


The Casper-rw will be used for persistent storage. Any installed software or setting files will be stored here.


Meanwhile, the usbdata section will contain the NTFS file system. This system will be accessible to Linux, Windows, and macOS. This section can be utilized from the live Ubuntu on the USB drive. Any files copied onto usbdata from another computer will also appear on the live Ubuntu. Essentially, usbdata can act as a means to share information between the live Ubuntu and any other computer that has the USB drive plugged in.


Here is how each section will look on a 16GB USB:


The first step in this process is to download the Ubuntu ISO file that needs to be placed on the USB drive. Additionally, if creating a live USB from a live disk, verify that Ubuntu’s Universe repository is enabled. To check for this, use the following command:


sudo add-apt-repository universe


Another tool that will be needed to run persistence is mkusb, which is not included within the standard Ubuntu installation. mkusb needs to be added to the repository so that Ubuntu is able to install it. Installing this tool is easy and painless–first, follow this command.


sudo add-apt-repository ppa:mkusb/ppa


Next, Ubuntu will need to refresh the package lists for registered repositories. This can be done by typing this command:


sudo apt-get update


The mkusb package can now be installed by the following command:


sudo apt install –install-recommends mkusb mkusb-nox usb-pack-efi


Although mkusb can usually be relied on to correctly identify USB drives, it’s best to double check. In the event mkusb states that it will wipe out a drive, it will be the USB drive that is currently being altered and not another drive that might be on the system.


After installing mkusb, open a terminal window and type this command:


lsblk


The above command will list the block devices on a computer. Each USB drive has an associated block device.


Upon enacting this command, a display screen will show drives currently connected to the computer. One internal hard drive is titled sda and a section within it is titled sda1.


Now, plug in the USB drive and activate the lsblk command again. Take note that the results from lsblk have changed. The USB drive will now be an option among the results.


Additionally, a new item called sdb should be visible in the results. Within sdb will be sdb1, which is the USB drive in use (however, if there are multiple USB drives plugged into the computer, the name might be different; double check the results to be certain).



Now that the USB is identified, mkusb can be launched. To launch, press the Windows key on the device and type “mkusb.”


Afterward, click the mkusb icon once it is visible. The device will then ask to run “mkusb version dus” (which relates to the chosen USB drive). Select “Yes.” If the USB drive is password-protected, there will be a prompt to enter the password before continuing.


Be advised: this action will wipe the contents of the USB. Click “OK” to acknowledge.


A drop-down menu will appear with the option “install (make boot device).” Click this option and continue by pressing “OK.”


Another drop-down menu will appear–this time, the option “Persistent live – only Debian and Ubuntu” should be visible. Click this option and press “OK.”


A file browser dialog will show up on the screen of the device. Search for the Ubuntu file that is downloaded, choose this option, and select the green “OK.”


A list of USB drives that are currently plugged into the device will be presented on the screen. Again, if there are multiple USB drives plugged into the device, be certain to select the correct option. Once verified, click “OK” to proceed.


A list of items with the phrase “usb-pack-efi (default grub from ISO file)” will be presented. Select this line and press “OK” to proceed.


Another option will appear, this time to alter the percentage allotted for persistent storage within the casper-rw section. The remaining storage will be given to the usbdata section. This section holds the NTFS file system and can be accessed from both Windows and Mac devices. It is recommended to split the data equally between these two sections and click the “OK” button.


At this point, mkusb will give the user an option to back out of this process. Once it is determined the user wants to continue, select “Go” from the line that states “Yes, I want to go ahead.” Click the “Go” button on the bottom as well. Once this process begins, a progress bar will inform the user of how quickly the procedure is being completed.


Finally, it is necessary to flush the file system buffers on the USB drive. It’s important to wait until “Work done” appears before continuing. Once the computer shows that this process has completed, click “OK.” It’s important to close out any other dialog boxes that may pop up on the screen.


A few lines of output will become evident in the terminal window. A line of text on the bottom of the screen should read “Press Enter to finish mkusb-dus.” Upon pressing the Enter key, the window will close. Now, the user can reboot the computer and then boot from the USB drive in use. Alternatively, the USB drive can be unplugged and booted to another device.


After you complete all of these steps, you will be the proud owner of a USB drive with persistent storage!


Hopefully this article has been useful to you, and you will enjoy working with this new tool.


Achievable blue logo on white background
Achievable blue logo on white background
Achievable SIE - $99
Pass the FINRA SIE on your first try with Achievable's online course. Includes everything you need: easy-to-read online textbook, 2,000+ review quizzes, and 35+ full-length practice exams.
Laptop displaying the Achievable exam prep dashboard and a smartphone displaying a quiz question
Achievable blue logo on white background
Achievable logo
Have questions?
Earn 20% as an affiliate
Partner with Achievable to generate new revenue from your website and help people achieve their professional goals
Learn more