I want to install Ubuntu to a USB hard drive so that it will run on all systems, that can run the LiveCD and store persistent data on a regular ext4 partition rather than a casper-rw
file. In every other way it should behave like a regular Ubuntu installation.
The problem
With Startup Disk Creator one is able to put the LiveCD image on a USB-device. Changes can be made persistent but are stored in a file that is limited to a few GB in size. Said persistent file (additionally to being size restricted) has the problem that it isn't readable like data on a normal partition.*
My question
So how do I get the LiveCD on a USB disk in such a way that the changes are stored in a normal partition rather than a persistence file? Also the persistent changes shouldn't be restricted to a few GB in size but use whole partition of many 100 GB if need be.
I suspect there is a tutorial out there for this, but my google-fu is just not good enough to find it.
tl;dr:
Sytem should run on all hardware configurations, have full functionality of the LiveCD and be stored on a regular ext4 partiton without using ramdisks and casper-rw. FU casper-rw.
*I know one could mount the casper-rw file from another OS and get to the data this way but that's a hassle.
This is very easy to do, although the "casper-rw" name will still show up once :)
Your target USB disk must have at least two partitions; I recommend using GParted to create a new partition table.
casper-rw
(all lower case, no quotes)Use UNetbootin to write your chosen live CD ISO to the first (vfat) USB partition.
Once everything is done, the final step is to delete the small
casper-rw
file created on the vfat partition you installed the live CD on, so that the large ext4casper-rw
partition is used instead. Mount this partition (here,sdb1
), and delete/casper-rw
.Persistence (via the
persistent
kernel option) should already be set up if you used UNetbootin, so safely eject the USB and you're ready to go!PS: If you don't want to use UNetbootin and you are using the "Startup disk creator" in Ubuntu then you need to do some edits to your
syslinux/txt.cfg
file as follows:Persistent partitions have not worked with syslinux type installs such as SDC, UNetbootin, Rufus, etc since 14.04, (unless the partition is located on a separate drive). An attempt boot will end with BusyBox.
Syslinux 6.03 offers full support for NTFS, (and many other fs), so there is no longer a 4GB persistent file size limit required to satisfy FAT32. YUMI uses Syslinux 6.03 as does RUFUS.
https://www.pendrivelinux.com/yumi-multiboot-usb-creator/
https://rufus.akeo.ie/
Mkusb is a grub2 type bootable flash drive maker that uses a FAT32 partition for boot, a write only ISO9660 partition for the OS, a ext4 casper-rw partition for persistence and a NTFS data partition accessible to both Linux and Windows.
https://help.ubuntu.com/community/mkusb
It should satisfy your specification.
For what it is worth the following is how I make a Persistent flash drive:
Boot Live CD or Live USB. Plug in flash drive. Start gparted.
Create 2 GB FAT32 partition, (on the left side of the bar). (size is optional, extra space can be used for file storage and transfer to Windows machines).
Create a 4 GB ext2 partition to the right of this, labeled it "casper-rw". (ext3 and ext4 also work).
Create a partition in the remaining space and label it "home-rw". (optional, creates a separate home partition).
Close gparted. Un-mount and re-mount flash drive. Start "Create a live usb startup disk", (usb-creator). Select "Discard on shutdown". Press "Make Startup Disk. When usb-creator finishes, Go to the root folder of your Live USB Enter the syslinux directory, (or for UNetbootin the root directory). Make the syslinux.cfg file writeable Replace the contents of the file syslinux.cfg with:
Shutdown, remove CD, reboot.
First time booting go to users and groups and create an account with yourself up as an Administrator, with password if desired.
Note: The above code will bypass the Try/Install and Language screens.