From Ubuntu you can create an SD card image this way (this requires superuser privileges, e.g., via sudo
):
dd if=/dev/mmcblk0 of=mybackup.img bs=4M status=progress
Beware the dev node (mmcblk0
) is not a partition. There will be mmcblk0p1
and mmcblk0p2
partitions, they are not what you want. You want the whole SD card device. It may be listed as something else, e.g., if you use a USB card adaptor it will be something like sdb
(and the partitions, sdb1
and sdb2
).
To put the image back on a card:
dd if=mybackup.img of=/dev/mmcblk0 bs=4M status=progress
This will destroy whatever was on the card. There is no point in formatting or prepping it first, dd
is all that is needed.
A potential problem with this is that the image may be bigger than the new card, for which reason you may want to shrink it:
Reverse the expand root FS 1
As a final comment, using dd
or anything else which copies the entire card everytime is the 2nd worse possible way of maintaining a backup, 1st being not doing anything until it is too late. So it's better than nothing, but you may want to consider an alternative, particularly if you need to keep the backup frequently updated.
That post also explains how to create an empty image using fdisk
. If you have a copy of the SD card contents from SD card copier, you can create a new card the exact same way, e.g. fdisk /dev/mmcblk0
instead of fdisk test.img
. Make the first partition ~60 MB and the second one can just take the rest of the space, then rsync
everything back in.
You should check the backup copy contents first to make sure it did not include any of the stuff mentioned in that post that should not be in a backup (/proc
, /dev
, etc.).
dd
or anything else is an atrocious method, but it is common anyway. I'm unfamiliar with SD card copier, but I've added a footnote above that might be of use to you. – goldilocks Dec 15 '18 at 21:26