Skip to content

padiks/debian-usb-with-persistence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Debian Live USB with Persistence (Tested on Debian 12.4.0 XFCE)

This guide explains how to create a Debian Live USB with persistence, allowing changes, installed applications, and settings to survive reboots.

Download Debian Live ISO

We are using Debian 12.4.0 Live ISO for this tutorial. You can download it from the official archive:

Debian 12.4.0 Live ISO (amd64, ISO-hybrid)

If you prefer to check the latest versions or other releases, you can also visit:

Debian Live Images

For this tutorial we intentionally use Debian 12.4.0 (Bookworm, XFCE).


Important Notes

  • Debian 12.11 and Debian 13 (Trixie): Persistence behaves differently on these releases. With limited root space (~1 GB), changes and installed applications may not persist like a full install.
  • Debian 12.4.0 Live ISO: Persistence works as expected, similar to a full hard-disk installation.
  • After creating your USB with Debian 12.4.0, you can safely update the system to the latest point release (e.g., Debian 12.11).
sudo apt update && sudo apt upgrade

This will bring it up to Debian 12.11.


Disclaimer

This guide is based on community contributions and my own testing. Original persistence steps were adapted from StackExchange. All credit to the original author(s).

Original Author Attribution (Footnote)

Jeff Schaller, StackExchange Profile, Post date / last edited: Sep 22, 20191

Use this guide at your own risk. Writing to the wrong device with dd can erase data permanently. Double-check your USB device name (e.g., /dev/sdb) before running commands.


Steps

Note: This guide was tested using MX Linux Live USB; any Linux distribution with necessary tools (dd, fdisk, mkfs, etc.) should work. Tested with SanDisk USB stick; other brands may vary.

1. Download the Debian 12.4.0 Live ISO

Choose your download path. Example:

cd /home/demo/Live-usb-storage
wget -c http://get.debian.org/images/archive/12.4.0-live/amd64/iso-hybrid/debian-live-12.4.0-amd64-xfce.iso

Tip: Make sure you have enough free space in your download folder (~4GB).

2. Plug in the target USB and unmount partitions

sudo umount /dev/sdb1 2>/dev/null
sudo umount /dev/sdb2 2>/dev/null

Tip: Ensure no other programs are accessing the USB to prevent errors.

3. Modify the ISO to enable persistence

LANG=C sed 's/splash quiet/persistence /;s/quiet splash/persistence /' \
    </home/demo/Live-usb-storage/debian-live-12.4.0-amd64-xfce.iso \
    >/home/demo/Live-usb-storage/debian-live-12.4.0-amd64-xfce.iso-persist.iso

Tip: Check the file path is correct to avoid overwriting the wrong ISO.

4. Identify your USB device

lsblk -o NAME,SIZE,MODEL,MOUNTPOINT

Tip: Carefully check the device name (e.g., /dev/sdb) before proceeding. Using the wrong device in later commands like dd or mkfs can erase important data.

5. Write the modified ISO to USB

sudo dd if=debian-live-12.4.0-amd64-xfce.iso-persist.iso of=/dev/sdb bs=4M status=progress oflag=sync

Tip: Double-check the of= device to avoid erasing other drives. This command can take several minutes.

6. Unmount, remove, and reinsert the USB stick

sudo umount /dev/sdb1

Tip: Replugging ensures the system recognizes the new ISO write before creating partitions.

7. Create a persistence partition

sudo fdisk /dev/sdb <<<$'n\np\n\n\n\nw'

Tip: Make sure you are creating the partition on the correct USB device.

8. Format the persistence partition

sudo mkfs.ext4 -L persistence /dev/sdb3

Tip: Labeling as persistence is required for the Live USB to recognize it.

9. Mount the persistence partition

sudo mount /dev/sdb3 /mnt

10. Create the persistence configuration file

On Debian (tested), the following works:

sudo echo '/ union' >/mnt/persistence.conf

Note: On some other Linux distributions, the above may fail because the redirection (>) happens before sudo applies. If so, try one of these alternatives:

# safer — uses tee with sudo
echo '/ union' | sudo tee /mnt/persistence.conf

# or run a shell as root so the redirection is performed with sudo
sudo sh -c "echo '/ union' > /mnt/persistence.conf"

Tip: Verify the file was created:

ls -l /mnt/persistence.conf
cat /mnt/persistence.conf

11. Sync data to disk

sudo sync

12. Unmount the persistence partition

sudo umount /mnt

13. Boot and use your Live USB with persistence

  • Reboot your computer and select the USB in BIOS/UEFI.
  • At the boot menu, choose the first option (Live system). This is the only choice that enables persistence; other options, like full install, are not relevant.
  • After booting, any changes, installed applications, and saved files will persist across reboots.

Tip: If persistence does not seem to work, confirm the partition is labeled persistence and that persistence.conf exists at the root.


Troubleshooting

If persistence does not work after following the steps:

  1. Check the partition label
    The persistence partition must be labeled exactly persistence.

    lsblk -o NAME,LABEL
    
  2. Verify persistence.conf exists and is correct

    ls -l /mnt/persistence.conf
    cat /mnt/persistence.conf
    

    It should contain:

    / union
    
  3. Confirm you booted with persistence enabled
    At the boot menu, choose the first option (Live system).
    If you select "failsafe" or "forensic" modes, persistence will not load.

  4. Recheck partition number
    On some setups the persistence partition may not be /dev/sdb3.
    Use lsblk to confirm which partition was created.

  5. Try a different USB stick
    Some USB brands handle hybrid ISO + persistence partitions better than others.
    If problems continue, repeat the process with another drive.


License

This guide is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0). You are free to share and adapt the material, provided proper credit is given and adaptations are shared under the same license.

Credits

  • Original persistence method: Jeff Schaller, StackExchange (2019)
  • Adapted, tested, and documented by padiks
  • Guidance & formatting help: ChatGPT

Notes

  • Tested on Debian 12.4.0 XFCE with persistence enabled.
  • Debian 12.11 and Debian 13 persistence behaves differently; see tutorial notes.
  • USB brand and host Linux distribution may affect results; proceed at your own discretion.

Contributing

This guide is provided as a finished resource. No additional contributions are expected at this time.


Enjoy your portable Debian system with persistence!

Footnotes

  1. Included for proper credit. Steps adapted and tested for Debian 12.4.0.

About

Create a Debian Live USB with persistence (tested on Debian 12.4.0 Live ISO)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors