Apparently, persistent live USBs are fairly simple to set up. I originally learned to create one for Linux Mint Debian Edition from here. It turns out that the procedure is exactly the same for some other ISOs. Specifically, I tried it on CrunchBang because I couldn’t find a specific guide for CrunchBang Waldorf. I also prefer to have some extra space on my USB for other storage space, so I tried tacking on an extra partition at the end, and it worked! (Your mileage may vary; at least one OS, Elementary, didn’t work with this method.)
- Unetbootin (Windows or Linux)
- Gparted (Linux) or other hard drive partitioner (Windows)
- Text editor (Windows or Linux)
- USB drive
1. We will be using Unetbootin for the initial ISO install. Unetbootin will not recognize the drive unless you format the drive to FAT32.
2. Also, so Unetbootin doesn’t complain about not being able to access the drive, you will need to mount the USB drive somewhere. I’m assuming that your drive is /dev/sdb and mounted in /media/mountpoint; replace as needed.
sudo mount /dev/sdb1 /media/mountpoint
3. Using Unetbootin, install the ISO of your choice on your USB.
4. You can reboot and see if the ISO installed correctly; you will need to press the designated key for your motherboard so that your computer will boot from a secondary device. If you can boot into the ISO, you’ve got the live USB part. Now for the persistence part. If you did reboot, boot back into your computer.
5. If you didn’t reboot, make sure you unmount the USB so Gparted doesn’t complain in the next step.
sudo umount /media/mountpoint
6. Using Gparted, shrink the partition with the ISO. How much you do this is up to you; the ISO isn’t going to get any bigger, but I made mine larger so that if I ever want to swap the ISO out for a larger one, I don’t need to repartition.
7. Using Gparted, create another partition labeled “persistence.” This is the partition holding all the persistent data. I made mine 2GB so I’d have plenty of room for persistent applications, settings, and other things. Format it ext2, ext3, or ext4. I like ext2 because it has less overhead.
8. Finally, again using Gparted, create another partition and let it fill the rest of the space. This is the extra storage partition. Format it whatever you’d like; I picked NTFS so that it would still be readable from Windows.
9. Before you apply your changes, make sure you’ve done all the previous partitioning steps correctly. Then, apply your changes.
10. Mount the first partition, the one with the ISO.
sudo mount /dev/sdb1 /media/mountpoint
Open syslinux.cfg, at the root of the partition, in a text editor. For the “unetbootindefault” and “ubnentry0” labels, under “append,” after “boot=live,” add the word “persistence.” For those two blocks, it should look like this (with the additions in bold):
menu label Default
append initrd=/ubninit boot=live persistence config quiet
menu label Live Session
append initrd=/live/initrd.img boot=live persistence config quiet
This tells the bootloader to tell the kernel to be in persistence mode (I think). Save the file.
11. Mount the second partition, the persistence one.
sudo mount /dev/sdb2 /media/mountpoint
Create a single file named “live-persistence.conf.” Open it in a text editor and insert a single line:
I have no idea precisely what this does; I think it persistent-izes all of the root filesystem. Save the file.
12. Reboot into the USB. You should now have a persistent live USB with a bit of extra space at the end.
13. If you ever want to change distros, just use Unetbootin to install another ISO. Make sure you edit syslinux.cfg in the root partition for the new distro, and don’t forget to wipe all folders (but not live-persistence.conf) from the persistent partition.
EDIT: it looks like Elementary, Ubuntu-based Linux Mint, and Ubuntu itself uses a casper-rw partition instead of a persistence partition. A good guide for the Ubuntu-based Linux Mint, which I couldn’t get to work persistently without this workaround, is here. The workaround essentially creates a casper-rw partition, tells unetbootin to set up persistence for a 100mb casper-rw file, and deletes the file. This sets all the settings necessary for persistence, but it allows use of the partition instead of the file.