0

I have a USB (8.0 GB, kingston) and inside it a Kali Linux image. I often used it in live mode w/ persistence, and I have some data there (plus config of the whole system) that I obviously don't want to lose. But, by some reasons, I have to dispose myself of that USB. My question is: Is there some way to back up everything, in a way that after getting another USB I could use the backup and reinstall it?

Many people suggesting dd command, I do not know if that works because of the way that persistence bootable USB are made: here

1

To create an image from a drive

sudo dd iflag=fullblock if=/dev/sdx of=/path/to/new.iso status=progress

Alternatively, to create a USB drive from an image

sudo dd iflag=fullblock if=/path/to/iso of=/dev/sdx status=progress

Replace /dev/sdx with your USB drive, e.g. /dev/sdc.

WARNING: It is very important that you make certain you are using the correct drive. If you don't use the correct drive, you could lose your data. To check your currently mounted drives, use the command lsblk.

Note: Copying large files (1 GB or higher) can take a long time, be patient.

  • 1
    On Linux systems don't bother using dd for this kind of copy operation; use cat instead. It's easier and often faster (never slower). In your case the dd is desperately inefficient - and slow - because you're using the default (512b) block size. – roaima Apr 6 '17 at 7:45
  • @roaima I have always used dd for such operations, in fact, I always assumed that cat would be slower, but thank you for explaining it to me :) – Michael Wilcox Apr 6 '17 at 7:57
  • See unix.stackexchange.com/a/9492/100397 for some facts backing up my claim. – roaima Apr 6 '17 at 9:50
  • I did not knew I could use dd command for that, i had used dd before for creating the bootable USB. But now it seems there is a controversy here, I should use cat instead of dd? And if yes please edit the answer for others who might stumble here with the same question – Deltab Apr 6 '17 at 12:46
  • The confusion here lies in that roaima does not acknowledge that adding iflag=fullblock will have the same effect as using cat without losing the fine-grained control. – Tanami Apr 7 '17 at 2:38
0

You can use dd to create a disk image of your Kali USB as it were.

And then you can write that disk image to another USB of equal or greater size to restore it.

The command must not be run from within the disk to be copied (so not inside Kali).


The command format is dd if=/dev/sdX of=/dst status=progress

Where sdX is the /dev device for the USB drive which has the Kali install on it.

And dst is where you want to put the image, i.e. (/home/user/kali.img)


dd is a very powerful command so you must double-check the if=/ and of=/ flags or else you may corrupt your main hard drive.

  • 2
    On Linux systems don't bother using dd for this kind of copy operation; use cat instead. It's easier and often faster (never slower). In your case the dd is desperately inefficient - and slow - because you're using the default (512b) block size. See unix.stackexchange.com/a/9492/100397 for some facts backing up my claim. – roaima Apr 6 '17 at 9:50
  • This is interesting but you should see yarchive.net/comp/linux/page_sizes.html – Tanami Apr 7 '17 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.