Cloning and Debian persistent live
Cloning (copying each byte as it is, creating a one-to-one copy) is a very simple and reliable method to create a boot drive (live drive or install drive) from a linux hybrid iso file.
There is no conventional way to make a cloned Debian iso file persistent, because it has a read-only file system, ISO9660, (and read-only 'partition table').
Using mkusb (BIOS/UEFI)
It is possible (and I would say rather simple) to use mkusb to create a persistent live drive from a Debian live iso file. mkusb supports Debian 8 or newer, and you should use the current version of mkusb (version 12.3.3 or newer).
mkusb creates a partition table and 5 partitions:
- NTFS partition for exchange of data with Windows computers (optional size)
- Extended partition or
- FAT32 boot partition for booting with
grub (both in UEFI and BIOS mode)
- ISO9660 partition containing clone of the iso file
ext partition for persistence, where your modifications (and files) are stored
mkusb does the following tweaks automatically:
- The boot option
persistent as in Ubuntu)
- The label
persistence on partition #5 (not
casper-rw as in Ubuntu)
- The file
persistence.conf with the content
/ union at the top level of partition #5.
This structure is created by the bash shellscript
dus-persistent, when you use mkusb version 12, alias
mkusb-dus. If you want all the details, install mkusb and read the content of
dus-persistent, or read it directly via phillw.net/isos/linux-tools/mkusb/dus-persistent.
The default settings of mkusb can be used for Debian 8, 9 and 10, and the persistent live drive will work when booted in BIOS mode and UEFI mode (but not with secure boot).
(In the previous version mkusb 12.3.2 you must set 'usb-pack-efi' manually in the 'settings' menu for Debian 10 in UEFI mode.)
Using manual setup (UEFI only)
If you want an UEFI only boot flash drive you do not need an installer at all.
You just need to format flash drive with FAT32 and set boot flag on. Then use whatever is your favorite extraction tool like 7zip to extract & copy ISO to FAT32 partition. See Do it yourself for more details.
I verified this method with the standard live iso file (small, no graphic desktop environment),
So this way you can make a USB boot drive with Debian 10 (64-bit). It will be live-only and boot in UEFI mode.
- Create a FAT32 partition big enough to store the files from the iso file (add approximately 5 % to the size of the iso file)
- Mount the FAT32 partition
- Extract the content (directory tree with all the files) of the iso file to the FAT32 partition
Now you have a live-only USB boot drive
Edit the word
persistence to the end of the line(s) starting with
linux in the file
ext2 partition in the unallocated space (behind the FAT32 partition)
- Put the label
persistence on the
- Mount the
/ union to the file
persistence.conf in the
ext2 file system
Unmount all partitions on the flash drive before you unplug it, or reboot
Now you have a persistent live USB drive with Debian 10.
Command output seen from within the persistent live drive:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 9.0M 1.6G 1% /run
/dev/sdb1 4.0G 826M 3.2G 21% /run/live/persistence/sdb1
/dev/loop0 610M 610M 0 100% /run/live/rootfs/filesystem.squashfs
tmpfs 7.8G 0 7.8G 0% /run/live/overlay
/dev/sdb2 11G 38M 11G 1% /run/live/persistence/sdb2
overlay 11G 38M 11G 1% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
tmpfs 7.8G 0 7.8G 0% /tmp
tmpfs 1.6G 0 1.6G 0% /run/user/1000
$ lsb_release -a
Distributor ID: Debian
Description: Debian GNU/Linux 10 (buster)
$ lsblk -fm /dev/sdb
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT SIZE OWNER GROUP MODE
sdb 14.8G brw-rw----
├─sdb1 vfat USBBOOT 7176-C538 3.2G 20% /usr/lib/live/mount/persistence/sdb1 4G brw-rw----
└─sdb2 ext2 persistence 2b324439-d63e-4a19-bf57-d49ecb881828 10G 0% /usr/lib/live/mount/persistence/sdb2 10.8G brw-rw----
You can see that the size of
overlay matches that of
/dev/sdb2 which indicates that the persistence is working.
It is possible (and I would say rather simple) to use mkusb-minp to create a persistent live drive from a Debian live iso file. mkusb-minp supports Debian 10 or newer. This simple shellscript is developed from mkusb-min. Both of them 'wrap a safety belt' around the cloning process to help avoid writing to the wrong device.
This is a good option, if you do not want to add software via a PPA or in general want to use only tools that you can understand.