Caution: This needs an overhaul to reflect USB stick layout changes (ESP partition). Could not reproduce it working with a debian-live-11.2-amd64 image.
The next step will allow you to get a debian live usb with persistence:
- Get an iso.
- Format the drive.
- Prepare the files.
Get the iso
Download an iso-hybrid of debian: https://www.debian.org/CD/live/. Copy the iso image to your empty USB stick. All data on it will probably be erased. In the examples below, /dev/sdd is assumed to be the USB stick device. You've got to check your device with e.g. dmesg|tail.
Create additional partitions on the drive
We can use:
- FAT partition with boot flag,
- ext4 partition with label persistence. The label "persistence" is mandatory.
Prepare the files
Lets copy files to newly created partitions.
Changes required to existing FAT partition
We have to mount the FAT partition, lets mount /dev/sdd2 to /mnt. Then unarchive the iso to /mnt.
# mount /dev/sdd2 /mnt # cd /mnt # 7z x /home/user/iso/debian-live.iso
??? We need to do some changes on the files.
# mv isolinux syslinux # for f in $( grep -FRil "splash quiet" ); do echo $f; LANG=C sed 's/splash quiet/persistence /;s/quiet splash/persistence /' -i $f; done; # cd syslinux # rename "s/iso/sys/" iso* # cd ~ # sync # umount /dev/sdd1
EXT4 partition with label Persistence
Create a new ext4 partition with label persistence. The label "persistence" is mandatory.
We need to put a conf on the persistence partition.
# mount /dev/sdd3 /mnt # cd /mnt # echo "/ union" > persistence.conf # sync # umount /dev/sdd3