Create Kali Linux persistent live USB (Part 2/3)

This article is the second part of the series on creating an encrypted portable Kali Linux USB with persistence. This article describes the process of enabling persistence on a Kali Linux live USB. The process to create a Kali Linux Live USB is described in the first part of this series.

In the first part of this series, we have seen that a Kali Linux Live USB can be used on multiple Laptops or PCs for performing Vulnerability Assessment and Penetration Testing (VAPT) activities. However, the drawback of live USB is that the updates or tools you install and data you generate as reports during VAPT, will be lost upon restart of Live Session i.e. the data is not persistent across live reboots. Whenever you will restart your live session, Kali Linux initial operating system image with default tool set will load.

To overcome this issue, you will need to make Kali Linux Live USB as a persistent drive. This will enable retaining data between reboots and across different systems as well. It is assumed that you have already created a Kali Linux live USB (if not, please check out (Part 1/3) of this series). Let us now continue with the process to enable persistence on Kali Linux live USB. Follow the following steps to make the Live USB persistent:

1. Boot from Kali Linux Live USB

Insert the Kali Linux live USB in a USB slot on your PC. Reboot the PC and enter BIOS setup. The key to enter bios setup is different on different make and model of laptops and desktops. There search for an option to enable booting from removable USB drives. You may also need to temporary disable secure boot on Windows PC to boot from Kali Linux USB.

Reboot your PC and press a key such as F9 (or some other key as per make and model of your PC) to display boot menu. Select the Kali Linux USB drive from the boot menu instead of hard disk.

2. Select “Live USB persistence” from Kali boot menu

If you will be able to successfully boot from Kali Linux Live USB, the Kali Linux live menu will be displayed as shown in following figure:

Kali Live Persistence

There will be multiple options to boot into Kali Linux from your live USB. In the previous post we have seen how to load the Kali Linux live session using first option i.e. “Live System”. Now, let us see how to create a persistence session. Scroll down to fourth option i.e. “Live system with USB persistence” and press Enter key to load Kali Linux session.

3. Create new partition

As you are aware, the Kali Linux live USB will occupy over 3 GB and under 4 GB space and create two partitions, while, the rest of the capacity of the USB will be available as un-allocated space. For illustration, I have used a 32 GB USB drive (28.7 GB displayed as actual usable capacity) to make it persistent in this post where 3.6 GB (sdb1) and 896 KB (sdb2) are space used as existing partitions while the balance space is not used by any partition.

 

We will now create a new partition in this un-allocated space just after the second Kali Linux partition. This partition will be made persistent in later steps. For now, let us follow the following steps:

a. Check USB drive path using “lsblk” command.

As you can see the path of the USB drive is /dev/sdb (this can be sda, sdc, etc. depending on number of disks in use in your PC. Make sure which one is your USB mainly by confirming the size of the USB drive). Also, there are two existing partitions sdb1 and sdb2.

kali live usb cli

b. create new partition in free space using fdisk [usbdrive path as parameter] command. For e.g.

sudo fdisk /dev/sdb

fdisk utility will provide a command prompt to perform various operations on disk drives.

fdisk cli

Choose the options in a sequence to create new partition as shown in the following figure: 1. Create new partition – Type “n” and press Enter

2. Partition type: Type “p” or leave blank as “p” is default value and press Enter

3. Partition number: Type “3” or leave blank as “3” is default value and press Enter

4. First Sector: Press Enter to select default value

5. Last Sector: Press Enter to select default value

6. Save new partition information: Type “w” and press Enter

Run “lsblk” command again to check new partition:

Kali linux live persistent partition

The new partition of size 25.1 GB has been created as /dev/sdb3.

Now, create an ext4 file system in this new partition using mkfs.ext4 command and label it as “persistence” using -L. The exact command is as following:

sudo mkfs.ext4 -L persistence /dev/sda3

The output of the above command will be as shown below:

mkfs

4. Create “persistence.conf” file on the new partition

Create a mount point and mount the new partition on it. Let us create a mount point as /mnt/mydrive and mount /dev/sda3 to it using mount command with -p flag (to create parent directories, if required) as per following example:

sudo mkdir -p /mnt/mydrive

sudo mount /dev/sdb3 /mnt/mydrive

mkdir mount

Now, Create a “persistence.conf” file with “/ union” as content in the file using the following command:

echo “/ union” | sudo tee /mnt/mydrive/persistence.conf

Now, unmount the partition using umount command as shown below:

sudo umount /dev/sdb3

The above steps are shown in image below:

tee

Reboot the PC and load Kali Linux again with persistence option.

5. Check persistence on new partition

Now, create a new file on the Kali Linux Live desktop which is loaded with persistence option.

Note: Always choose “Live System with USB persistence” option every time to load the persistence live session. You will now see that the file created on desktop is still present. Thus, all new data is persistent and being retained across reboots.

You can also watch the above process in the this video.

In our next article of this series, you will see the procedure to encrypt the Kali Linux persistent Live USB. This will prevent the confidential data on your drive from being misused in case you lost the USB or if its deliberately stolen by miscreants.

Stay tuned!!

«« Previous ΙΙ Next »»

1 Comment

Leave a Reply (if you any question or feedback for us)