PDA

View Full Version : A Windows Only Method For Creating A Live Kali USB With Persistence



KizarnyTizeeth
2015-02-18, 08:11
Hi all,

I had a tremendous difficulty attempting to use a Kali virtual machine to install Kali to a usb 3.0 flash drive. It just wouldn't work for me. So I read up on creating live USB's with persistence and cobbled this method together. It may work for you if all else fails.

You will need:


USB Flash Drive of at least 8gb (I used a Lexar 16 gb USB 3.0 connected to a USB 2.0 port)
A windows PC (I used Win 7, Service Pack One)
MiniTool Partition Wizard (http://www.partitionwizard.com/download.html)
DiskPart
Win32 Disk Imager
Kali Image v 1.0.7 or greater (I used kali-linux-1.0.9a-amd64.iso)



Step One--Run diskpart from windows (Only necessary if multiple partitions already exist)


Select Start → run → diskpart



From diskpart prompt, use capacity to determine the number of your USB drive ‘x’

list disk
Select your USB drive

select disk x
Effectively remove all data

clean
And finally, create the primary partition

create partition primary

Step 2--Quick format your USB drive FAT32 from My Computer


Step 3--Render Kali Image on to USB Drive

Start-->run>win32diskimager

Select Kali Image Path
Select USB drive to be written letter
Select write



Step 4--Test your Kali Live USB


Select Live USB during boot





Step 5--Return to Windows, open MiniTool Partition Wizard


Select Kali Imaged USB drive from the GUI
Select the unallocated, ie rightmost, partition. (Note size, you’ll need it next step)
Select a file format of either ext2 or ext4
Label/Name the partition ‘persistence’
Apply changes (top left of GUI)



Step 6--Boot into Kali Live USB again

Open Terminal


lsblk
Match partition size to available space, referenced as sdbx (sbd5 for
mine)


mkdir -p /mnt/my_usb
mount /dev/sdbx /mnt/my_usb
echo "/ union" > /mnt/my_usb/persistence.conf
umount /dev/sdbx


Step 7--Verify that persistence.conf has been written to the ‘persistence’ partition

Step 8--Boot with Live USB Persistence, celebrate

Note: I have tried this three times on two different flash drives and its worked 2/3. If it fails for you once try switching ext2 with ext4. I used one drive extensively and it worked flawlessly

This post has been edited to correct an error. Modifications have been submitted in the color red.

Aatrixx
2015-02-24, 21:07
I also struggeled with the virtualbox installation so I followed your instructions and was still having no luck with persistence...

so i went back to Step 5 and renamed the partition to "persistence" and continued with the rest of your instructions....(Celebrate!! Everything works now !! Thanks)

Step 5--Return to Windows, open MiniTool Partition Wizard

Select Kali Imaged USB drive from the GUI
Select the unallocated, ie rightmost, partition. (Note size, you’ll need it next step)
Select a file format of either ext2 or ext4
Label/Name the partition ‘persistent’ <---- persistence
Apply changes (top left of GUI)

Hakkelaar
2015-03-25, 18:33
Dear KizarnyTizeeth,

To my knowledge, the number in SDBx doesn't stand for 'size', but is somekind of partition number.

Also, the mkdir -p /mnt/my_usb is unclear to me.

Please elaborate.

RyanHx
2015-04-14, 14:08
I worked through this method and everything went smoothly until the very last step, when I reboot the "persistence" partition is no longer detected by Linux, and instead the "persistence.conf" is moved into the root file system. I've tried the method with both Ext2 & 4 with no luck either way - the partition is detectable through "lsblk" however, any suggestions?

zynperor
2015-06-10, 15:47
@Hakkelarr - /dev/sdb{x} is in reference to the partition number on the device of /sdb.

Also for clarification to the mkdir command - further information is found here: http://linux.die.net/man/1/mkdir

Here is what I did to make an encrypted persistent USB for Kali. I have gone through this, tried it myself and verified the method works. Read fully, carefully and pay attention to what is typed.

:: Items needed ::

USB drive, 8GB or larger - I used a 16GB

MiniTool Partition Wizard
http://download.cnet.com/MiniTool-Partition-Wizard-Free/3000-2094_4-10962200.html

Win32 Disk Imager
http://sourceforge.net/projects/win32diskimager/

Kali Linux ISO
https://www.kali.org/downloads/

:: USB drive setup ::

After the MiniTool Partiton Wizard, Win32 Disk Imager and Kali Linux ISO have been downloaded, install the two software packages as normal with defualt settings.

MiniTool Partiton Wizard - Use this tool to create two partitions, one for Kali and the remainder for the persistent partition. The 16GB USB drive was divided as 6GB for Kali and the remainder for the persistent partition. Continue with formatting the partition for Kali, do not format the persistent partition. The Kali partition needs to show and have a drive letter assigned so Win32 Disk Image works properly to write the Kali Linux ISO. The persistent partition will be setup after the Kali has been booted.

Win32 Disk Image - Use this tool to write the Kali Linux ISO to the USB drive. After the ISO is written to the USB drive, reboot the computer with the USB drive inserted so the computer boots from the USB drive instead of the main hard drive. Adjustments to the boot settings within the BIOS may need to be done to allow booting from the USB drive.

:: Persistent USB partition setup ::

After Kali Linux has been started open terminal and type the following: gparted /dev/sdb
This loads gparted with the USB drive already selected. Do it this way to avoid confusion of loading the incorrect partition and possibly trashing the main drive.

After the gparted partition manager starts, right click within the unallocated section, select new from the drop-down menu.

Create a primary partition, choose ext4 as the file system, label the partition: persistence

Click on "Add" then "Apply" and let the computer format the partition in ext4 with the label persistence.

When the process is completed, close gparted and open terminal. Depending on which type of persistent partition is preferred, type the following commands:

:: For unencrypted partition use the following commands ::

mkdir -p /mnt/my_usb
mount /dev/sdb3 /mnt/my_usb
echo "/ union" > /mnt/my_usb/persistence.conf
umount /dev/sdb3
reboot

:: For an encrypted partition use the following commands ::

cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb3
cryptsetup luksOpen /dev/sdb3 my_usb
mkfs.ext4 -L persistence /dev/mapper/my_usb
e2label /dev/mapper/my_usb persistence
mkdir -p /mnt/my_usb
mount /dev/mapper/my_usb /mnt/my_usb
echo "/ union" > /mnt/my_usb/persistence.conf
umount /dev/mapper/my_usb
cryptsetup luksClose /dev/mapper/my_usb
reboot

:: Verify persistent USB is working ::

After the computer has rebooted into Kali Linux, create and save a test document to the newly created parition. The new partition should show on the desktop, mine showed with a label as unrecognized. Reboot. Verify the document is saved to the partition. If the file is not there, try again - making sure the file is saved correctly. If the file is still not saving correctly, start over with USB drive setup - something was missed or not done correct.

zynperor
2015-06-10, 22:46
*** post deleted by its author ***