Enable Persistent Storage on a Kali Linux Live USB – A Practical Guide
Turn a Kali live USB into a stateful system by creating a persistence partition, configuring unionfs, and verifying that data and settings survive reboots. Follow this step‑by‑step workflow to keep your tools, scripts, and user files across sessions.
30 Aug 2026, 01:13 UTC

Desired Outcome
After following this guide you will have a Kali Linux live USB that remembers user data, configuration files, and installed tools between reboots. The persistence layer will be mounted automatically when you boot the USB with the Live with persistence option, overlaying the specified directories with a union filesystem.
Prerequisites
- USB drive with at least 8 GB free space (4 GB is the minimum for a practical persistence partition).
- Live Kali Linux media (USB or ISO) booted into a running session.
- Root or sudo privileges on the live system.
- Basic familiarity with Linux command‑line tools:
fdisk,mkfs.ext4,mount,lsblk,nano,tee. - Backup any existing data on the USB before making partition changes.
Procedure
- Identify the USB device
Run
lsblkorsudo fdisk -lto locate the block device representing the USB. It will typically be/dev/sdXwhereXis a letter (e.g.,/dev/sdb). Verify the size matches your USB to avoid overwriting the host drive. - Create a new partition
Using
fdisk(or a GUI tool like GParted) create a primary partition that uses the remaining free space on the USB. Example withfdisk:
After exiting, runsudo fdisk /dev/sdX # Inside fdisk: # n (new partition) # p (primary) # 1 (partition number) # (accept defaults for start and end) # t (change type) # 83 (Linux filesystem) # w (write changes)sudo partprobe /dev/sdXto refresh the kernel partition table. - Format the partition as ext4
Format the new partition with a journaling filesystem that supports the union overlay. Replace
/dev/sdX1with the actual partition name.
The labelsudo mkfs.ext4 -L persistence /dev/sdX1persistenceis optional but helps identify the partition. - Mount the persistence partition temporarily
Create a mount point and mount the partition.
Verify withsudo mkdir /mnt/persistence sudo mount /dev/sdX1 /mnt/persistencedf -h | grep persistence. - Copy the persistence configuration template
The live system provides a template file at
/etc/persistence. Copy it to the root of the persistence partition.sudo cp /etc/persistence /mnt/persistence/persistence - Edit the persistence configuration
Open the file and add the directories you want to persist. A common choice is
/homeand/etc.
Each line follows the syntax:sudo nano /mnt/persistence/persistence # Add the following lines: unionfs / unionfs /home /home unionfs / unionfs /etc /etcunionfs <live‑root> <unionfs‑root> <target‑dir> <target‑dir>. The example above tells the system to overlay/homeand/etcwith the persistent layer. - Create the persistence key file
Unionfs requires a key file named
persistence.confin the partition root. Create it with:echo "file=unionfs" | sudo tee /mnt/persistence/persistence.conf - Unmount the partition
Safely unmount before rebooting.
sudo umount /mnt/persistence - Reboot and boot with persistence enabled
Shutdown the live session and boot the USB again. In the Kali boot menu, choose Live with persistence (or add the
persistentboot parameter if you are using a custom kernel command line). When the system starts, it will automatically mount the persistence partition at/media/persistenceand overlay the specified directories.
Verification
- Confirm the persistence partition is mounted
After boot, run:
You should see a line similar to:mount | grep persistence
/dev/sdX1 on /media/persistence type ext4 (rw,relatime) - Test data persistence
Create a test file in
/home:
Reboot and verify the file still exists:touch ~/testfile
If the file is present, thels ~/testfile/homedirectory is being persisted. - Verify configuration persistence
Edit a system file, for example
/etc/apt/sources.list, add a comment, then reboot. After reboot, check that the comment remains. This confirms that/etcis also persisted.
Recovery / Rollback Options
- Delete or recreate the persistence partition
If the partition was created incorrectly, you can delete it with
sudo fdisk /dev/sdXand recreate it using the steps above. Remember that any data stored on the partition will be lost unless you back it up first. - Disable persistence temporarily
Remove or rename the
persistence.conffile from the partition root, then reboot. The live system will ignore the persistence partition until the file is restored. - Back up the persistence data
Before re‑formatting the USB or making significant changes, copy the contents of the persistence partition to a safe location:
sudo rsync -av /media/persistence/ /path/to/backup/
Limitations and Practical Checks
- Unionfs increases boot time slightly. If you notice sluggishness, consider limiting the number of persisted directories.
- Conflicts can arise if the same file exists in both the live and persistent layers; the persistent layer overrides the live version.
- The persistence partition is erased if the USB is reformatted with a different filesystem. Keep backups of the
/media/persistencecontent if you plan to re‑format. - Kali Linux uses a rolling release model. Verify your version with
cat /etc/os-releaserather than relying on a fixed date. - Always double‑check the device name (
/dev/sdX) before partitioning to avoid overwriting the host system’s drive.
Conclusion
By following this workflow you can transform a standard Kali live USB into a portable, stateful environment. Persistent storage lets you keep custom tools, scripts, and user settings across sessions, making your Kali deployments truly portable and efficient.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.