Shrinking backup image

I noticed, that the official dietpi images are quite compact and resize during installation to the full SDCard capacity.
As I’m having a 128GB SDCard, I would like to shrink my backup images as well.
Can you tell me how to do this?
Maybe there are also other ways to get a compact backup of the OS…


Just a question: Are you creating real image *.img files? Or do you use dietpi-backup?

real .img

You should be able to generate a compressed DietPi image via the dietpi-imager script. This script is located in the .meta subdirectory in the GitHub DietPi share or can be executed via:

bash -c "$(curl -sSfL '')"

But this would require to have the SD card placed as USB connected device on another Linux box. It will not work on a running system as the script is simply not designed for this.

To get the partition resized on first boot, you would need to activate dietpi-fs_partition_resize.service before creating the image.

ok, would this solution work:
i create an additional data partition on the sdcard and before doing the os backup, i delete this data partition in gparted.
then I select the option "“Read Only Allocated Partitions” in the win32diskimager.

But I am not sure if this causes extra problems after writing it back to the sd card.
what do you think?

honestly I never tried something like this and I’m not sure if this will work or what side effects could occur.

I was using dietpi-imager but now I see that it is gone, and I don’t see it anywhere… and I looked to see if there was a note as to why its gone, or alternative?

OPPS I see it now, its in


Welcome to our community.

Yes it has been moved to have all build tool’s in one place. The post above has been updated.

1 Like