Creating Kali Linux Live USB with Persistence, a simple guide

Source: Google Image

Who knows you can add a persistent storage with your Kali Linux on-the-go? Well actually you can do it with simple steps. In this tutorial I would like to tell you how to make a Kali Linux on-the-go (Live USB), but this Kali is special because we can save our data in the same USB we use for boot that “portable” Kali. We call it Kali Linux with Persistence. Actually there is an official documentation for making this stuff in here. You may want to follow the official documentation then, but this post is based on those documentation too. You can choose either you want to read this post or read the official documentation above.

Requirements for this tutorial:

  1. Kali linux ISO image (get it here)
  2. terminal
  3. run as root (for simple executions, but not mandatory)
  4. USB flashdisk or any portable storage (minimum size of 4GB, recommended size 8GB+)

Note: I’m using Lubuntu 16.04 when I wrote this post

Okay let’s begin the steps..

First, you must load your Kali ISO image into your USB flashdisk. You can read how to do that in here. And make sure you have enough space left for the persistent storage.

Second, make the unallocated space left in your USB flashdisk to become an ext4 filesystem, and label it with “persistence”. You can do this using command fdisk /dev/sdX or you may want to use command gparted instead.

root@linux:~# fdisk /dev/sdX

In my case, it should be like this:

root@linux:~# fdisk /dev/sdb

After going into fdisk command line, press n to make a new partition. Then type p to specify the partition primary. Then go give the partition number, first sector, and last sector for the persistent storage. In my case, I would like to use the default from the system, and looks like this:

As you can see, I make the new partition number 3, first sector default, last sector default, because I just want to make the space left to become the persistent storage. Then we can type w to save the new partition, and the result is the new partition is created and its size is 905MB (because I’m using the Kali Linux ISO image of size 2.9GB and I use my 4GB USB flashdisk, 3.8GB of actual size).

Note: If you get a warning like this:

You may want to replug your USB flashdisk to refresh or to tell the system that the partition table has been changed.

After the partition created, now we can make the filesystem inside that partition. We can execute:

root@linux:~# mkfs.ext4 -L persistence /dev/sdXY

Where /dev/sdXY is your partition location. In my case, it should be like this:

root@linux:~# mkfs.ext4 -L persistence /dev/sdb3

You may want to run fdisk -l command to find the correct partition.

Next, the third step, we make that new partition into becoming really “persistence” storage. This can be done by mounting the partition at /dev/sdXY to /mnt/directory, and do some configuration. You can execute this command to mount the desired partition:

root@linux:~# mkdir /mnt/directory

root@linux:~# mount /dev/sdXY /mnt/directory

In my case:

root@linux:~# mkdir /mnt/my_kali

root@linux:~# mount /dev/sdb3 /mnt/my_kali

Next we should do some configuration. This kind of configuration I mean is that we must make a text file named “persistence.conf” and type “/ union” (without quotations) into that file. This can be done by following command:

root@linux:~# echo “/ union” > /mnt/directory/persistence.conf

In my case:

root@linux:~# echo “/ union” > /mnt/my_kali/persistence.conf

Next we must unmount the persistent partition using umount command, like this:

root@linux:~# umount /dev/sdXY

In my case:

root@linux:~# umount /dev/sdb3

Finally, our “Kali Linux with Persistence” is ready to use. Now you can boot your persistent Kali by selecting the “Live USB with persistence” option at startup.

Note: To tell whether your persistent storage is working or not, you can check in your Kali Linux desktop, like this:

If the “persistence” partition is coming up in your desktop, we can tell that you failed to make the persistent storage. Otherwise, if the “persistence” storage doesn’t coming up, you’re ready to use the Kali Linux with Persistence.

Note: The third step can also be done when you’re booting from your Kali Linux Live USB.

Tech hobbyist, Learn from scratch, Learning the hard way, Just want to share anything