E2B can map a persistence file which has been formatted as ext, to a partition on the E2B USB drive. Linux will usually look for a particular volume label (e.g. casper-rw or persistence) and use the new partition.
RMPrepUSB v2.1.732 or later can be used to easily make an ext2, ext3 or ext4 persistence file using the 'Make Ext2/3/4 FS' button.
Use ext3 or ext4 for reliable persistence
When using an ext2 file for persistence, I have found that it can easily get corrupted if you don't shut down linux nicely. A corrupt persistence file can cause a linux ISO file to fail to boot, even though the ISO file itself is completely good!
Make a persistence file using linux
If you do not have Windows and cannot use RMPrepUSB to make a persistence file, you can create a persistence file on the E2B USB drive under linux:
Use cd to get to the directory where you have mounted the USB drive - e.g. /media/USBDrive, then create a file as follows (example uses 1GB mint-rw, volume name is normally casper-rw)
(use sudo if required)
dd if=/dev/zero of=mint-rw bs=1M count=1024
OR making a sparse file using dd may be faster, try this...
Re-sizing or transferring data to a new persistent file
1. Create the new ext file (e.g. \newubuntu-rw) - see above for mkfs commands.
2. Boot to the linux ISO (not with persistence)
3. Use these linux commands to copy the contents (change sdb to the correct letter for your E2B drive, and ubuntu-rw and newubuntu-rw as required):
sudo mkdir /mnt/source /mnt/target
sudo mount -o loop /dev/sdb1/ubuntu-rw /mnt/source
sudo mount /dev/sdb1/newubuntu-rw /mnt/target
cp -r /mnt/source/* /mnt/target
When you boot from a CD or DVD, persistence is not normally enabled because a CD/DVD does not support 'random-writes'. However, when booting from a USB drive with some linux ISOs, Easy2Boot can boot directly from the ISO and enable persistence. To do this a special .mnu file is needed. This is just a grub4dos menu which will be read by Easy2Boot during startup and the contents will be added to it's own 'in-memory' menu.
The instructions on how to add a persistence file are included inside each of the .mnu files. There are .mnu files which support persistence for linuxmint, XiaOpan, ubuntu, YLMF, Puppy, Slax, Ubuntu, LUbuntu, Fedora, Backtrack 5, BitDefender Rescue (old versions only), geebox, kali linux, kaspersky, PCLinuxOS, Porteus, StartOS, Zorin, AntiX, android x86, debian-based distros and XBMCbuntu. More may be added later - check the E2B download for new additions!
Different sample .mnu files are included the \_ISO\docs\Sample mnu Files folder for each type of ISO file. Just open a .mnu file using a text editor and read the instructions. All of these can be run on one E2B USB drive, all with separate persistence files. If your ISO filename does not exactly match, simply change the name of the ISO file in the .mnu file (it may appear more than once). Most often linux will look for a file of a particular file name or volume name (e.g. casper-rw). However, on a multiboot USB drive, this can cause problems because you can only have one file called casper-rw. Also, some linux distros cannot access NTFS partitions, so this is a problem if you boot from an NTFS drive. However, Easy2Boot avoids both of these problems by using a .mnu file in conjunction with a ext2 file.
Note: Booting from a partition image file (.imgPTN) with persistence is not supported using .mnu files, however it is possible to modify some versions of linux (e.g. Ubuntu) to support UEFI-booting with persistence.
Some linux distros (e.g. Knoppix+Persistence) can be added to E2B, but it is done using a .imgPTN partition image and not using a .mnu file. Search this site and my blog to find instructions.
How it works
Most of the .mnu files work on the following principle:
1. The user first creates a file containing data formatted as an image of an ext2/3/4 filesystem on the E2B drive. The Volume Name inside the ext file image usually needs to be a specific name (for instance, casper-rw).
e.g. filename=fred ext image volume name=casper-rw
Tip: Using RMPrepUSB for this makes it very easy - just click on the Create ext2/3/4 FS button!
If you want to create an ext file that is larger than 4GB, you will need to format your USB drive as NTFS before you add the E2B files and add your ISO files, etc.
2. When E2B runs the ISO, it changes the USB drive partition table (ptn entry 3 is normally used) so that the partition start and end positions match the position of the ext file:
ptn3 start = start of fred
ptn3 end = end of fred
For this reason the ext file needs to be contiguous - ensure you run WinContig before you boot from the E2B USB drive (only needs to be done once).
The volume label of the volume when mounted by linux, will be whatever you set when you made the file originally (e.g. casper-rw). This is usualy a fixed name and should not be changed.
3. When E2B boots from the ISO, it adds special command line parameters (also known as 'cheat codes') which tell the linux kernel to look for a persistence partition.
4. When linux boots, it looks for a Volume name of 'casper-rw' (the name can vary with different versions of linux). Because linux has mounted all the partitions, it sees partition 3 has a volume name of 'casper-rw' and uses it for persistent storage.
Note: Partition 4 will usually point to the .ISO file which has been set up by E2B.
If you need to boot another linux distro which also requires a casper-rw persistent filesystem, this is not a problem. For instance, you can create another ext2 file called 'fred1' with the same volume name of 'casper-rw' and E2B will map that as partition 3 when it boots the ISO.
The .mnu file will contain code to map the ext file and boot from the ISO file.
In this way, you can have multiple linux ISOs, all using different persistence files, on one E2B USB drive. Even if the linux distro does not support NTFS, this is not a problem because linux will be able to mount the ext partition (it has no need to access the NTFS filesystem).
You could even have two Ubuntu menus, one for 'Steve' and one for 'Mary' - they both can boot from the same ISO, but use different persistent files and so boot with different Desktops and settings, etc.. Just make two .mnu files, one for Steve and one for Mary and make sure they use two different ext2 files (but keep the volume name the same). e.g.
UEFI-Booting with persistence
It is possible to have a .imgPTN partition image file AND an ext persistence file and boot via UEFI with persistence.
For details of how to do this for Ubuntu-based payloads, read my blog post here.
Note that this does require bespoke menus to be added and so these instructions will only apply to Ubuntu-based payloads.
It may be possible to support some other linux payloads in this manner, but each one may require a special menu to be added or edited.
Fully-installed linux OS
By creating a new partition using a large empty FAT32 .imgPTN file, it is possible to install a full linux OS to that partition.
This means that one E2B USB drive can contain multiple full linux OS's by having multiple .imgPTN files (and the E2B drive can comprise of just one NTFS partition!). Check out some of the blog posts here (e.g. Kali full install).