Setting up a Kali Linux USB drive with persistence is a great way to have a portable and customized security testing environment. This allows you to save files, configurations, and installed tools across reboots.
Here is a step-by-step tutorial:
🛠️ Prerequisites
Before you start, make sure you have the following:
-
A USB Drive: Minimum 8 GB recommended (16 GB or more is better). Be aware that all data on the USB drive will be erased.
-
Kali Linux ISO File: Download the latest version from the official Kali Linux website.
-
An ISO Flasher Tool: We will use Rufus for this tutorial, as it can handle the persistent partition creation. (This requires a Windows or Linux machine to set up the USB initially).
-
A Computer to perform the setup.
1. Prepare the USB Drive using Rufus
-
Download and Run Rufus: Download the latest version of Rufus and run the executable. It’s a portable application, so no installation is necessary.
-
Select Your USB Drive: Under Device, select your target USB drive. Double-check that you have selected the correct drive, as the next steps are destructive.
-
Select the ISO: Click on SELECT and browse to the Kali Linux ISO file you downloaded.
-
Choose Persistence:
-
Under Partition scheme, select MBR (for broader compatibility) or GPT (for modern systems).
-
Under Target system, choose BIOS or UEFI.
-
Crucially, drag the slider labeled “Persistent partition size” to the desired size. A good starting point is 4 GB or more, depending on your USB size and needs. Leave the rest for the normal Kali root partition.
-
-
Start the Process: Click START.
-
Confirm Warnings: Rufus will likely warn you about erasing all data and may ask to download files. Confirm these prompts.
-
Wait for Completion: The process will take some time. Once the status bar turns green and says “READY”, you can close Rufus. Your USB is now bootable with a separate, unformatted partition for persistence.
2. Format the Persistence Partition
The partition created by Rufus is raw and needs to be formatted with a Linux file system and labeled correctly. This step must be done after you have booted into Kali Live.
A. Boot into Kali Live
-
Reboot your computer with the newly created USB drive inserted.
-
Enter the Boot Menu: You will need to press a key (often F2, F10, F12, or Delete) during the startup to select your USB drive as the boot device.
-
Select Live Boot: When the Kali boot menu appears, select the “Live (forensic mode)” option. This ensures that the main drive is not automatically mounted, which is safer, but more importantly, it loads Kali without attempting to mount a persistence partition yet, allowing you to format it.
B. Format the Partition
Once Kali Live has loaded:
-
Open a Terminal: Click the terminal icon.
-
Identify the Persistence Partition: Use the
fdiskcommand to see all partitions on your drives. Your USB drive will likely be/dev/sdbor similar.Bash
sudo fdisk -l-
Look for the partition on your USB drive that is the size you specified in Rufus and has the Linux or Linux filesystem type. It will likely be something like
/dev/sdb3or/dev/sdc3. Note down the correct partition name (e.g.,/dev/sdXN).
-
-
Format the Partition: Use the
mkfs.ext4command to format it as an EXT4 file system. Replace/dev/sdXNwith your actual partition name.Bash
sudo mkfs.ext4 -L persistence /dev/sdXN-
The
-L persistenceflag is crucial. It labels the partition exactly aspersistence, which is the label Kali looks for automatically when booting with persistence.
-
3. Create the Configuration File
Now you need to create a simple configuration file inside the newly formatted persistence partition to tell Kali how to use it.
-
Create a Mount Point:
Bash
sudo mkdir -p /mnt/my_persistence -
Mount the Persistence Partition: Replace
/dev/sdXNwith your actual partition name.Bash
sudo mount /dev/sdXN /mnt/my_persistence -
Create the Configuration File: This file tells the system to use the entire partition for the
/(root) filesystem.Bash
echo "/ union" | sudo tee /mnt/my_persistence/persistence.conf -
Unmount the Partition: Safely unmount the partition before rebooting.
Bash
sudo umount /mnt/my_persistence
4. Boot with Persistence
-
Reboot the system with the USB drive still inserted.
-
Select Persistence Boot: At the Kali boot menu, this time choose the option: “Live USB Encrypted Persistence” or “Live USB Persistence”. The exact name may vary.
-
Verify Persistence:
-
Once Kali loads, create a test file on the Desktop, install a small program (like
htop), or change the desktop background. -
Reboot and choose the persistence option again.
-
If the test file, installed program, or settings remain, your persistence is working!
-
Would you like me to find a YouTube video tutorial that demonstrates this process visually?