A Linux USB drive is normally a blank slate every time you start it. You can boot, install programs, save files and change settings. But as soon as you start up, all your changes are deleted and you are back to a new system. This can be useful, but if you want a system that pops up where you left off, you can create a live USB with persistent storage.
Where Renewable Storage Works
When creating a USB drive with endurance, I want to assign up to 4GB of USB drive for a persistent overlay file. Any changes you make to the system, for example, save a file on your desktop, change the settings of an application or install a program, are stored in the overlay file. When you boot the USB drive on any computer, the files, settings and installed programs will be there.
This is an ideal feature if you want to keep a live Linux system on a USB drive and use on different PCs. You do not need to configure your system right from the start every time you start. You do not need endurance if you only use a USB drive to install Ubuntu and then run it from your hard drive afterwards.
There are some limitations. You cannot change system files like the kernel. You cannot perform large system upgrades. You also cannot install hardware drivers. However, you can install most applications. You can even update most installed applications so you can be sure your persistent USB drive has the latest version of your preferred browser.
Persistence does not work with every Linux distribution. We have tested it with the latest versions of Ubuntu-Ubuntu 1
How to create a persistent Ubuntu USB drive on Ubuntu
You need a computer that is already running Ubuntu to perform this process. You also need a USB drive with enough storage capacity to set up persistence. We used a 16 GB drive, but an 8 GB drive would also work. The larger the drive, the more sustained storage you can have.
Grub, boot and Ubuntu partitions take up less than 2 GB. The rest of the space on the USB drive will be used for
casper-rw is used for sustained storage. For example, software you install and set files will be stored here.
usbdata will be formatted with the NTFS file system. It will be available for Linux, Windows and MacOS. This partition is also available from the live Ubuntu on the USB drive. This means that all files copied to the
usbdata partition from another computer will be available to your live Ubuntu.
In other words, the partition
usbdata acts as a "shared folder" between your live Ubuntu and any other computer to which you connect the USB drive. It's pretty cool.
The screen below shows how the resulting partitions looked at our 16 GB drive.
Although a 16 GB USB drive was used to examine this article, an 8 GB drive would work just as well. It will only have less storage space.
First, you need to download the Ubuntu ISO file you want to place on the USB drive.
Second, the tool you are going to use is called
mkusb . It is not part of the standard Ubuntu installation. You must install it. To do this, enter the following three commands. The first command adds
mkusb repository so that Ubuntu knows where to install
sudo add-apt-repository ppa: mkusb / ppa
The next command forces Ubuntu to update the packet lists for the registered repositories.
sudo apt-get update
We can now continue installing the package
mkusb with this command:
sudo apt install - install - recommend mkusb mkusb-nox usb-pack-efi
mkusb does an awesome job of identifying USB drives. It's good, but there's nothing like knowing for yourself. When
mkusb tells you to wipe a particular drive, you can be sure it is the USB drive you are planning to use and not another device on the system.
In a terminal window, type the following command. The
lsblk command lists the blocking devices on the computer. Each station has a block unit attached to it.
The output of
lsblk displays the drivers currently connected to the computer. There is an internal hard drive on this machine called
sda and there is a partition on it called
Insert your USB drive and use the
lsblk command again. The output 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. It has a partition called
sdb1 . It's the USB drive.
If you already have more than one drive in your computer, the name of your USB drive will be different. No matter how it is called, the device must not be in the previous
lsblk listing the [USB] drive.
When you know which device you have USB drive, you can start
mkusb . Press the Super (Windows) key and type "mkusb". The
mkusb icon appears. Click the icon or press Enter.
A dialog box will ask you if you want to run the Do USB Stuff version of
mkusb . Click the "Yes" button.
A terminal window with black background will appear and a dialog box will ask you for your password. Enter your password and click the "OK" button.
Warning : This process will clear the contents of the USB drive!
Click "Install" entry in the list and click "OK" in the warning dialog to confirm that you understand this . OK "button.
Select the" Continuous live "setting – only Debian and Ubuntu" in the list and click "OK" 19659005]
A file browser dialog box appears. Browse to the Ubuntu ISO file you downloaded, select it and click the green "OK" button.
In the screen below, we select the Ubuntu 19.04 ISO image from the download folder.
You will see a list of the USB drives connected to your computer. This allows you to select the correct USB drive.
There was only one USB drive connected to the test machine that was used for this article. As we confirmed above, it is called
sdb . We have confirmed that the USB drive we want to use so that we can continue to trust. Click the "OK" button.
When the dialog box shown below, select "usb-pack efi (default grub from ISO file)" in the list and click the "OK" button .
You still have another opportunity to choose. You can select the percentage of storage space for sustained storage in the
casper-rw partition. The rest will be used for the partition
usbdata which has the NTFS file system and can also be accessed from Windows PCs and Macs.
If you are happy to have free space on the USB drive split equally between these two partitions, let the slider go to the default value and click the "OK" button.
Now we just have to tell
mkusb ] that we are satisfied with all our choices and that it should continue.
To be clear, this is the last point you can back up. If you are sure you want to continue, select the "Go" button and click the "Go" button.
A progress bar shows how close the establishment process is.
The last stage of creation is to flush the file system buffers to the USB drive. You are also advised to wait until you see the phrase "Work done". It will indicate the process has completed.
When the process is complete, you will see a dialog with the phrase "Work done" highlighted in green. Click the "OK" button. If any other dialogs appear, close them by clicking the "Cancel" button.
A few output lines will scroll through the terminal window. You will be prompted to press "Enter" when ready.
Pressing "Enter" closes the terminal window. You can now either restart the computer and start from the USB drive or disconnect the USB drive, take it to another computer, and restart it.
RELATED: How to start your computer from a disc or USB drive
How to make a persistent Ubuntu USB drive on Windows
Update : We have been notified that the method used below (using Linux Live USB Creator) no longer works with the latest versions of Ubuntu. You must use the above method instead.
You need a large enough USB drive to set up endurance. Ubuntu claims it needs 2GB of storage on the USB drive, and you also need extra space for the persistent storage. So, if you have a 4 GB USB drive, you can only have 2 GB of persistent storage. To get the maximum amount of persistent storage, you need a USB drive of at least 6 GB in size.
Unfortunately, the Rufus utility Ubuntu officially offers to create live Ubuntu USB drives on Windows, not support for creating persistent storage systems. While we recommend using Rufus to create most of the Ubuntu USB drives, we need to use a different tool for this particular job.
Download the Ubuntu ISO file you want to place on the USB drive and the Linux Live USB Creator application.
Insert the USB drive you want to use in your computer's USB port and launch the "LiLi USB Creator" program that you just installed.
Select the USB drive you want to use in "Step 1: Select your key".
Provide your downloaded Ubuntu ISO file. Click the "ISO / IMG / ZIP" button under "Step 2: Select a Source", scroll to the .ISO file on your computer, and double-click it.
Use the options in the "Step 3: Persistence" section to select how much space you want to use for sustained storage on the USB drive. Drag the slider to the far right to select the maximum storage space.
You have now configured all the settings you need to configure. To create your live USB drive with persistent storage, click on the lightning icon under "Step 5: Create".
Give the tool some time to create the drive. When the process is complete, you will see a "Your LinuxLive key is now up and ready!" -Message. You can now either restart the computer and start from the USB drive or disconnect the USB drive, take it to another computer, and restart it.
To confirm 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 turn off the system and restart the USB drive. You should see the folder or file you placed on the desktop.