I was able to figure this out. UEFI cannot read from anything except FAT, but casper can. Here's instructions for how to create a Bootable Live USB with a squash FS > 4GB. This method does NOT destroy the whole USB unlike other Bootable USB creation methods.
Environment
- OS: Ubuntu 22.04
- ISO Creator: Cubic
- Source Image: Latest 22.04 Desktop downloaded from ubuntu.com
Bootable USB Partitioning
- Partition 1
- Format: FAT32
- Size: ~5GB
- Flags:
boot
- Partition 2
- Format: ext4
- Size: 10-15GB (enough size for the squashfs filesystem)
The rest of the USB can be partitioned as you like without removing any data during installation. Be sure to take note of the device mounts for your partitions, for example /dev/sda1
(FAT32), /dev/sda2
(ext4).
Instructions
Create your customized ISO using Cubic.
Follow instructions until you get to the Options page.
This is where we tell casper to load the squashed FS from a different location than the FAT32 boot partition.
First, we want to reference the UUID of the ext4 partition instead of it's device ID (/dev/sda2
in my case) since the device ID can change.
You can find the UUID of the ext4 partition you created using these instructions: https://linuxhint.com/uuid_storage_devices_linux/. Since my ext4 partition is /dev/sda2
, I can do this to get my ext4 UUID:
$ ll /dev/disk/by-uuid | grep sda2
lrwxrwxrwx 1 root root 10 Oct 10 20:38 727cac18-044b-4504-87f1-a5aefa774bdb -> ../../sda2
and this shows that my ext4 partition's UUID is 727cac18-044b-4504-87f1-a5aefa774bdb
.
Modify the grub config in the Boot tab. You'll need to modify the first menuentry
like so:
menuentry "Ubuntu RAM" {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper live-media=/dev/disk/by-uuid/727cac18-044b-4504-87f1-a5aefa774bdb toram file=/cdrom/preseed/ubuntu.seed quiet splash noprompt ---
initrd /casper/initrd.gz
}
Be sure to change /dev/disk/by-uuid/<UUID> to the correct ext4 partition UUID you found during this step!
Casper boot option documentation can be found here.
We've added the following boot options
toram
(note: remove this boot option if you do not have the RAM to hold the entire squashfs filesystem)
noprompt
live-media=<DEVICE_UUID_PATH>
We've removed the following boot options
When prompted for compression method on the Compression Page, feel free to choose LZ4 as this is fastest and filesystem.squashfs
file size no longer matters.
Generate your custom ISO.
Extract your custom ISO to some empty directory like ~/Documents/my-ubuntu-folder
.
Copy all files from the extracted ISO except for casper/filesystem*
to the FAT32 partition. casper/vmlinuz
and casper/initrd.gz
must be on the FAT32 boot partition.
You might see some warning of inability to copy symlinks because FAT32 doesn't support them; this is OK and you can skip these files while maintaining usability of the bootable USB.
- Create a directory named
casper
in your ext4 partition and copy all extracted casper/filesystem*
files to this directory.
Once finished, the casper
directory on your FAT32 partition should look like this:
$ ls -1 casper/
initrd.lz
vmlinuz
And the casper
directory on your ext4 partition should look like this
$ ls -1 casper/
filesystem.manifest
filesystem.manifest-minimal-remove
filesystem.manifest-remove
filesystem.size
filesystem.squashfs
You've now created a UEFI bootable USB that uses a separate storage partition for its read-only filesystem via casper's live-media
boot option.