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
quiet 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
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
quiet splash --- in the following files, (pre-22.04):
/isolinux/txt.cfg, (for BIOS boot persistence Rufus);
/syslinux.cfg, (for BIOS boot persistence UNetbootin);
/boot/grub/grub.cfg, (for UEFI boot persistence).
File location 20.04 and prior.
- In Ubuntu 22.04 and later add the word persistent one space after file=/cdrom/preseed/ubuntu.seed in grub.cfg.
File location 22.04 and later.
- 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?
Nowadays some Live Ubuntu apps will create Live Persistent USB's, Rufus, Ventoy, mkusb and Universal. Others like Startup Disk Creator, dd, Gnome-Disks and Etcher create ISO9660 based USB and are difficult to make persistent.