PDA

View Full Version : Making a Persistent usb flash drive with kali-linux 1.08



mmusket33
2014-07-27, 09:05
Making a kali-linux persistent usb with 1.08 is different from previous versions. You can read the kali.org approach and/or you can try our method. Each has its strengths. Here is how Musket Teams do it

1. Install kali-linux 1.08 on to the usb flash drive using XP and Win32DiskImager.exe. Make sure Win32DiskImager is pointed at your usb flash drive. When you browse to the location of your Kali-linux 1.08.iso, change the "Files of Type" from "img" to *.* - select the down arrow accross from "Files of Type" and you will get this selection in a drop-down menu. Once selected the kali-linux.iso file will appear. Select it and select "write" then sit back and wait while the diskimager does it's work. When fiished you now have a live version of Kali-linux. Boot the computer from the kali-linux 1.08 usb flash drive and test to see if it is working properly then shut it down.

To enable persistence so your work is saved between reboots do the following;

2. Run up a kali or Backtrack operating system with gparted installed. You cannot use the usb with kali-linux 1.08 on it as it will be locked during these operations, therefore a separate operating system must act on the usb flash drive.

3. Insert the usb with kali-linux 1.08 installed in the computer running a linux distro with gparted

4. Type gparted /dev/sdb

5. You will find /dev/sdb1
/dev/sdb2
unallocated area

6. Right Click within the unallocated section, then select new from the drop-down menu that appears.

7. Create a Primary Partition, Choose ext 4 as the file system, and label the partition with the word:

persistence

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

9. When the process is completed open up a terminal window and enter the following:


For unencrypted

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

========End of Unencrypted===========

For an encrypted partition

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

========End of encrypted===========

10. Shut down and reboot from the usb flash drive with kali-linux 1.08 installed When the kali-linux main menu appears select Live USB Persistence or Live USB Encrypted Persistence as installed.

11. To test that persistence is functioning open leaf pad and write a text file and save it to root. Use the terminal window and type ls and make sure the file was saved then reboot the computer, Select Live USB Persistence or Live USB Encrypted Persistence as installed and see if the text file you just saved appears. If the text file you saved is still there the persistence feature is working

12. If persistence is not working, start at item 2 again and work forward. You do not need to reinstall Kali Linux 1.08.

nigelmercier
2014-12-31, 16:55
Is it possible to do all of this from within Windows? I've got a Partition Tool (MiniTool Partition Wizard)

I did manage to create a persistence partition, but Kali told me that it didn't support EXT4.

L-dog23
2014-12-31, 18:13
Is it possible to do all of this from within Windows? I've got a Partition Tool (MiniTool Partition Wizard)

I did manage to create a persistence partition, but Kali told me that it didn't support EXT4.


Yes it is. Or you can partition the usb, boot kali and use gparted to format it to ext4 then use a terminal to encrypt it.

nigelmercier
2015-01-01, 11:21
I've got as far as Step 9, this is what my USB drive looks like:

http://i77.photobucket.com/albums/j54/nigelmercier/Misc/after9_zps030c3ed6.png~original

[1] There is a large unallocated space before the partition that was created by Win32DiskImager
[2] That partition is FAT16

nigelmercier
2015-01-01, 14:35
I've got as far as Step 9 ...
I've started again and now at Step 9 I get a drive with 3 partitions, after formatting the partition in EXT4 with the label persistence.:

http://i77.photobucket.com/albums/j54/nigelmercier/Misc/after9b_zps51deeb38.png~original

However, if I plug in the new USB drive, I get: "Unable to mount persistence"

If I then continue the steps from Step 9 "For unencrypted" I get the following errors:
mkdir -p /mnt/my_usb
Error: none

mount /dev/sdb3 /mnt/my_usb
Error: mount: wrong fs type, bad option, bad superblock on /dev/sdb3 ...

I assume this is because the partition is not mounted, but I have no idea what to do next.

nigelmercier
2015-01-02, 10:15
I've also tried in EXT3, same result.

L-dog23
2015-01-02, 22:19
The computer can not mount it because it requires a password.

Do this step once you have partitioned the drive and named it

For an encrypted partition

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


Then it should work

nigelmercier
2015-01-02, 22:32
The computer can not mount it because it requires a password.
Do this step once you have partitioned the drive and named it
For an encrypted partition


I don't want encrypted, how do I do that?

L-dog23
2015-01-04, 21:39
Easy. Just create a partition and name it 'Documents' and leave it :)

That will create a partition so you can save you documents with out kali live wiping it. Kali live will only wipe the user data off the kali partition.

I hope that helps :)

SamNeuer
2015-01-29, 00:08
Nice tutorial, thanks.
I've got 2 live USB sticks here atm, first one, 8gb, is the one from which I started kali.
The second one, with 18gb, is the one I want to get persitent. But if Kali on Stick1 is running,
and I plug in stick2 gparted only shows stick1 from which kali is running. Refreshing
devices dosn't work. Can't use gparted on USB while running from USB?

factgasm
2015-08-10, 09:43
Thanks for this.

I must have gone through twenty difference websites before I got to this one. This advice was so good I printed it out and stuck it my wall.

Win32Diskimager will do step (1) above using the ISO file provided you select *.* and (if necessary) uncheck the ISO file's properties as Read Only. I could get Kali v1.1.0a to work, it kept causing the error message "isolinux.bin missing or corrupt" so I reverted to the v1.0.9 version instead and that worked no problems.

factgasm
2015-08-10, 10:01
Cheers for this.

Alex linux
2015-08-10, 17:56
I dont have this "unallocated area" on USB key... how do I get it ?

pamamolf
2015-08-13, 20:01
It will be great if updated for Kali 2:)

robhill724
2016-01-27, 19:48
Can someone explain exactly what this command does. I get: permission denied

echo "/ union" > /mnt/my_usb/persistence.conf

mmusket33
2016-01-28, 05:51
It writes the text string "/ union" to a text file called persistence.conf and places this file on the persistence partition on your flashdrive.

MTeams suggests if you are installing kali 1.1, 2.0 or 2016 that you consult the following thread :

https://forums.kali.org/showthread.php?26731-How-to-make-a-persistent-usb-Kali2-0-flash-drive


Musket Teams

JuanDeLemos
2016-05-20, 12:29
The computer can not mount it because it requires a password.

Do this step once you have partitioned the drive and named it

For an encrypted partition

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


Then it should work



Can I, after doing that, save all changes I do in Kali Linux Live USB Persistence?

I will like to know how I can save sessions changes or all other changes I do in Kali during an session?

Thanks !!!

mmusket33
2016-05-21, 01:03
If you make a persistent usb install and select to load this install during boot then your work will be saved between reboots. You can update the flash drive. In 2016 rolling we are unsure if you can upgrade. Maybe someone else in these forums can offer info on upgrading.

Suggest you consult the thread below as the 1.08 is outdated.

https://forums.kali.org/showthread.php?26731-How-to-make-a-persistent-usb-Kali2-0-flash-drive

MTeams