A Linux live USB key is normally a blank slate at each startup. You can start it, install programs, save files and change settings. But as soon as you restart, all your changes are erased and you go back to a new system. This can be helpful, but if you want a system that picks up where you left off, you can create a live USB drive with persistent storage.
How persistent storage works
When you create a USB drive persistently, you allocate up to 4 GB of the USB drive for a persistent overlay file. Any changes made to the system, such as saving a file to your desktop, changing settings in an application, or installing a program, will be stored in the overlay file . Every time you start the USB drive on a computer, your installed files, settings, and programs are present.
This feature is ideal if you want to keep an active Linux system on a USB drive and use it on different PCs. You do not have to configure your system from scratch each time you start. You do not need persistence if you simply use a USB drive to install Ubuntu, then run it from your hard drive.
There are some limitations. You can not modify system files, such as the kernel. You can not perform major system upgrades. You can not install hardware drivers either. However, you can install most applications. You can even update most installed applications to make sure your persistent USB drive has the latest version of the web browser you prefer.
Persistence does not work with all Linux distributions. We have tested it with the latest versions of Ubuntu – Ubuntu 18.04 LTS and Ubuntu 19.04 – and it works. This should also work with Linux distributions based on Ubuntu. In the past, we have also been lucky with Fedora. Just download the appropriate ISO file and follow the instructions below.
How to create a permanent Ubuntu USB drive on Ubuntu
You will need a computer running Ubuntu already to run this process. You will also need a USB drive with enough storage capacity to configure persistence. We used a 16GB drive, but an 8GB drive would have worked as well. The bigger the disk, the more storage you can have.
The grub, boot and Ubuntu partitions take less than 2GB. The rest of the space on the USB drive will be used for the
casper-rw and the
casper-rw The partition is used for persistent storage. For example, the software you install and the settings files will be stored here.
usbdata the partition will be formatted with the NTFS file system. It will be accessible to Linux, Windows and macOS. This partition is also available from Ubuntu live on the USB drive. This means that all the files copied to the
usbdata The partition of another computer will be accessible to your Ubuntu live.
In other words, the
usbdata The partition acts as a "shared folder" between your live Ubuntu and any other computer to which you connect your USB key. It's pretty cool.
The screen shot below shows the appearance of the resulting partitions on our 16 GB drive.
Although a 16GB USB drive was used to research this article, an 8GB drive would work just as well. It would simply have less storage.
First, you will need to download the Ubuntu ISO file you want to place on the USB drive.
Secondly, the tool you will use is called
MKUSB. This is not part of the standard installation of Ubuntu. You will have to install it. To do this, enter the following three commands. The first command adds the
MKUSB repository so that Ubuntu knows where to install
sudo add-apt-repository ppa: mkusb / ppa
The following command forces Ubuntu to refresh its package lists for registered repositories.
sudo apt-get update
We can now proceed to the installation of the
MKUSB package, with this command:
sudo apt install - install-recommend mkusb mkusb-nox usb-pack-efi
MKUSB program does a great job of identifying USB drives. It's great, but nothing beats knowing for yourself. When
MKUSB indicates that the drive will be completely erased, you can be sure that it is the USB drive you plan to use and not another device in your system.
In a terminal window, type the following command. the
lsblk order list block devices on your computer. Each drive is associated with a block device.
The exit of
lsblk will show the players currently connected to your computer. There is an internal hard drive on this machine called
nda and there is a partition called
Plug in your USB drive and use the
lsblk order one more time. The exit of
lsblk will have changed. The USB drive will now be listed in the output.
There is a new entry called
sdb in the list. He has a partition called
sdb1. This is the USB key.
If you already have multiple drives on your computer, the name of your USB drive will be different. Regardless of how it is named, the device that was do not in the previous
lsblk registration must to be the USB reader.
Once you know which device is your USB key, you can launch
MKUSB. Press the Super key (Windows) and type "mkusb". the
MKUSB the icon will appear. Click the icon or press Enter.
A dialog box will ask you if you want to run the due version (Do USB Stuff) of
MKUSB. Click on the "Yes" button.
A terminal window with a black background will appear and a dialog box will prompt you for your password. Enter your password and click on the "OK" button.
Warning: This process will erase the contents of the USB key!
Click "OK" in the warning dialog box to confirm that you understand this well.
Click on the "Install (create a boot device)" entry in the list and click the "OK" button.
Select the 'Persistent Live' – Debian and Ubuntu only entry from the list and click the 'OK' button.
A file browser dialog box will appear. Navigate to the Ubuntu ISO file you downloaded, select it, and click the green "OK" button.
In the screenshot below, we select the Ubuntu ISO 19.04 image in the Downloads folder.
You will see a list of USB flash drives connected to your computer. This allows you to select the appropriate USB drive.
Only one USB drive connected to the test machine used for this article. As we confirmed above, he calls himself
sdb. We have confirmed that this is the USB drive we want to use so we can continue with confidence. Click on the "OK" button.
When the dialog box below appears, select the "usb-pack-efi (default ISO file default)" entry from the list, and then click the "OK" button.
You have another option to choose from. You can select the percentage of storage space used for persistent storage in the directory.
casper-rw partition. The rest will be used for the
usbdata partition, which has the NTFS file system and is also accessible from PCs under Mac and Mac.
If you want the available space on the USB drive to be shared equally between these two partitions, leave the cursor at its default value and click the "OK" button.
Now, we just have to say
MKUSB that we are satisfied with all our choices and that this should continue.
To be clear, this is the last point where you can go back. If you are sure you want to continue, select the "Go" radio button and click on the "Go" button.
A progress bar tells you how close the creative process is.
The last step of the creation is to empty the buffers from the file system on the USB drive. You are also advised to wait until you see the phrase "Work done". This will indicate that the process is complete.
When the process is complete, you will see a dialog box with the phrase "Work done" highlighted in green. Click on the "OK" button. If any other dialog boxes appear, close them by clicking the "Quit" button.
Some additional output lines will scroll through the terminal window. You will be prompted to press "Enter" when you are ready.
When you press "Enter", the terminal window closes. You can now either restart your computer and start from the USB key or disconnect the USB drive, take it to another computer, and start it there.
How to create a persistent Ubuntu USB drive on Windows
Update: We were told that the method below (using Linux Live USB Creator) was no longer working with the latest versions of Ubuntu. You will have to use the method above instead.
You will need a USB drive large enough to configure persistence. Ubuntu itself claims to need 2GB of storage on the USB drive, and you will also need extra space for persistent storage. So, if you have a 4GB USB drive, you can only have 2GB of persistent storage. To have the maximum amount of persistent storage, you will need a USB drive of at least 6 GB.
Unfortunately, the Rufus tool officially recommended by Ubuntu to create Ubuntu USB sticks live on Windows does not offer support for creating systems with persistent storage. Although we recommend using Rufus to create most Ubuntu Live USB drives, we will need to use a different tool for this particular job.
Insert the USB drive you want to use into the USB port of your computer and launch the "LiLi USB Creator" application you just installed.
Select the USB drive you want to use in the "Step 1: Choose Your Key" box.
Provide your downloaded Ubuntu ISO file. Click the "ISO / IMG / ZIP" button under "Step 2: Choose a Source", browse to the .ISO file on your computer, and then double-click it.
Use the options in the "Step 3: Persistence" section to select the space you want to use for persistent storage on the USB drive. Drag the slider all the way to the right to select the maximum amount of storage.
You have now configured all the settings you need to configure. To create your live USB drive with persistent storage, click the Lightning icon under "Step 5: Create."
Give the tool a little time to create the player. When the process is complete, you will see a message "Your LinuxLive key is now ready and ready!" You can now restart your computer and boot from the USB drive or unplug the USB drive, transfer it to another computer and boot it to that location.
To verify that persistent storage is working properly, start the USB drive and create a folder on the desktop or save a file to the desktop. Then shut down your system and restart the live USB drive. You should see the folder or file you placed on the desktop.