Can I convert a live Ubuntu USB to one with persistent memory?
Changing Live Pendrive to Persistent Pendrive
This works both with BIOS and UEFI.
Many people prefer a Persistent Pendrive that will save changes;
Create a Live Pendrive using Rufus or similar;
-
Boot the pendrive toram to make the drive editable:
Press Shift when booting; press Esc from Language; press F6; press Esc;
Type a Space and
toram
afterquiet splash ---
, and press Enter. -
Create a casper-rw file:
sudo dd if=/dev/zero of=casper-rw bs=1M count=512
sudo mkfs.ext3 -L casper-rw -F casper-rw
(where count=512
is the persistence size in megabytes, with a max of 4GB).
Move the new casper-rw file from home to the root of the Live Pendrive;
-
Add a Space and
persistent
afterquiet splash ---
in the following files:/isolinux/txt.cfg
, (for BIOS boot persistence Rufus);/syslinux.cfg
, (for BIOS boot persistence UNetbootin);/boot/grub/grub.cfg
, (for UEFI boot persistence). Shut down and reboot the persistent drive.
It's also possible to turn a Live USB into a Full-Install USB which has some advantages, except it won't install Ubuntu: Can Ubuntu be installed to the pendrive it was booted from?
Add a Persistent Partition to a UNetbootin Live USB, (Ubuntu 19.10+)
No additional USB drive required.
- Boot the USB drive "toram", At the UNetbootin boot menu press the Tab key. type a space then "toram" and hit enter.
Now the computer will boot toram (8GB RAM required for UNetbootin drive). You will be able to edit and overwrite the Live USB.
We will add a persistent partition and an optional NTFS partition for data storage.
Open GParted, select the USB drive and unmount it.
Shrink the FAT32 partition to a minimum.
Add a new ext4 partition for persistence.
Label the ext4 partition "casper-rw".
In the remaining space create a NTFS partition.
Apply all Operations.
Reboot in order to populate the casper-rw partition.
Make drive persistent
- Edit syslinux.cfg, adding a space and the word persistent to default boot, thus: "...quiet splash --- persistent".
If you have a live (live-only) Ubuntu USB drive, there should be nothing saved in it. An exception would be if Ubuntu was extracted from the iso file into a file system (for example: FAT32), and in that case you might have some files saved there, and they should be copied to some other drive or to a location in the internet cloud.
So, there is no system-specific 'custom' file in your live Ubuntu USB drive and therefore, no need to convert it. Instead, you can make a fresh installation of a persistent live system into your USB drive. You can also consider upgrading to a fast USB 3 pendrive (or even a USB SSD).
mkusb
is a tool that can create a persistent live drive and use the whole drive. It creates several partitions, including a casper-rw
partition with the ext4
file system for persistence. It can also create a usbdata
partition with the NTFS file system for exchange of data with computers running Windows.
See the following links:
https://help.ubuntu.com/community/mkusb
https://help.ubuntu.com/community/mkusb/persistent