5

I know there are other posts about how to create a live ubuntu usb with persistent memory - HOWEVER, there is no [question / answer] on how to convert a live (ubuntu) usb to one with persistent memory / storage. Is this possible?

2

3 Answers 3

7

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 after 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

(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 after quiet splash --- in the following files, (pre-20.04):

    /isolinux/txt.cfg, (for BIOS boot persistence Rufus);

    /syslinux.cfg, (for BIOS boot persistence UNetbootin);

    /boot/grub/grub.cfg, (for UEFI boot persistence).

  • In Ubuntu 20.04 and later add the word persistent one space after file=/cdrom/preseed/ubuntu.seed in grub.cfg.

  • 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 and Etcher create ISO9660 based USB and are difficult to make persistent.

9
  • Is ext3 required for a persistent? What does casper-rw have to do making it persistent? This is very interesting, I'd like to make a persistent USB myself for recovery tools but with a different FS and possibly even multiple distros. If I were to append toram to GRUB, would I be able to make a separate persistent partition that could auto install packages I've left in the persistent drive? Commented Mar 17, 2019 at 4:35
  • 2
    @avisitoritseems: The above assumes the drive is formatted FAT32. The casper-rw file is internally ext3 but exists in a FAT32 environment and can be seen by Windows. You can add as many distros as you have partitions, (using UNetbootin for Windows), but a persistent pendrive will use the first casper-rw file or partition it encounters on boot. Rufus and Startup Disk Creator do not allow persistent partitions, only the persistent files casper-rw and home-rw. mkusb would be a great base for what you want. You can also Full install as many OS as you have partitions without persistence problem Commented Mar 17, 2019 at 5:10
  • Apologies for the basic question, but what does mkusb do differently than simply making a ext4 partition with the unzipped ISO files and placing the .efi file in a FAT32 boot partition? I tried that just now and the bootloader wasn't able to find the kernel. Commented Mar 17, 2019 at 5:14
  • 1
    Mkusb makes a UEFI boot partition, BIOS boot partition, ISO9660 OS partition, ext2 casper-rw persistence partition and NTFS data partition that Windows can also use. Mkusb uses grub2 as a bootloader, (sdx3), the path to the kernel is found there. Commented Mar 17, 2019 at 5:22
  • How would one manually edit a grub2 conf prior to use to point the path to the kernel? What I am considering is using Rufus to create a Windows install USB, then installing rEFInd to the boot partition with modified .efi files to point to each unix distro for a multi-tool of installs. Commented Mar 17, 2019 at 5:35
4

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".
3
  • This answer is jumping the gun a little for 19.10, please excuse. Commented Sep 25, 2019 at 22:04
  • Thank you very much - most helpful.
    – Duncan
    Commented Sep 28, 2019 at 8:57
  • Note: At this time UNetbootin has not been updated since 19.10 Commented Nov 11, 2022 at 13:35
2

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

1
  • Thank you for your help and time - greatly appreciated.
    – Duncan
    Commented Mar 18, 2019 at 10:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .