I have installed Kali Linux on my Orange Pi board from the official website and made some configuration changes on top of the default installation. I was wondering if I can create a new image, a kind of savepoint, here so that I can directly install it on the memory card in case something went wrong with the installation in the future.

What I came up was to dump the entire memory of the flash card, bit-by-bit, using the dd utility but the problem with it is that it'll dump the entire 64 GBs even though the OS is barely over 3GB.

Now first off, if I use dd the way I mentioned and dump it back on the card, would it work? And how do I create the image of the proper size?

First off, dd will work very well if you dd the entire card and not the partition, i.e. something like:

dd if=/dev/sda of=/somewhere/filedump bs=512

to restore on the same card or on a card of the same size you would do the opposite, i.e.

dd if=/somewhere/filedump of=/dev/sda bs=512

now keep in mind that in order to do so your OS does not have to be booted, i.e. you need to boot with a DSL or any other USB boot stick and then dump the device forth and back. Otherwise you will not have consistency in the file system.

Now in order to avoid using unnecessary space there are a couple of options:

  1. do the dd dump once and then do rsync's to the dump in the future something like

    mount -o loop -t ext4 /somewhere/filedump /mnt/yourmountpoint

    rsync -avx / /mnt/yourmountpoint

  2. shrink the OS partition using parted and then dump the OS partition only (i.e. sda1 instead of sda). CAVEAT: if you play it back, the partition size needs to be identical with the original size.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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