How can I create an .img for later use?

Hello,

I just finished converting an Debian image into a DietPi system on a BananaPiPro (H20).

The final statement is: “Completed, disk can now be saved to .img for later use (…)

But there is no hint how to do this, and I can’t find this option in Etcher.
So: What do I have to do for this?

Cheers,
Lelo

If you have a windows machine

Use Win32diskimager it is capable of reading/writing raw .img files

Be advised…it copies the ENTIRE drive…so the image will the the same size as your sdcard…and they .img files can get pretty darn large

If you have a linux machine there is a program called PiShrink that will strip out all the “unused” part of the image and create an image that is much reduced

Thanks for your reply. So the upcoming steps are:

  • Enter “shutdown now” on the BananaPiPro

  • Take out the SD card, put it into a Win-PC and use “Win32diskimager” to create a large .IMG-file

  • Put this large .IMG-file to a Linux-PC and run “PiShrink” to create a smaller .IMG-file.

  • This smaller .IMG-file can then be written by Etcher to the SD-card if my system is messed up.

Right?

Precisely…or you can use the dd command on your linux machine circumventing the Win-PC if you have an active linux box anyway…

READING:
Insert the original sd card and check the name of the device (usually mmcblkX or sdcX):

sudo fdisk -l

In my case the sd card is /dev/mmsbkl0. Now you have to unmount the device:

sudo umount /dev/mmcblk0

Now to create an image of the device:

sudo dd if=/dev/mmcblk0 of=~/sd-card-copy.img

This will take a while.

Once it’s finished, insert the empty sd card. If the device is different (USB or other type of sd card reader) verify its name and be sure to unmount it:

sudo fdisk -l
sudo umount /dev/mmcblk0

Write the image to the device:

sudo dd if=~/sd-card-copy.img of=/dev/mmcblk0

The write operation is much slower than before.