How to create a 8GB image from 16 GB SD Card image

I have created my image on 16 GB SD card but to keep this 16 GB it takes lot of time (for creating backup and flashing).

Does there exists a process to manual (not copying complete device using dd) to backup the image.

For example by

  1. Creating a file of zero’s as master.img
  2. Then making a GPT partition on master.img
  3. And then copying first four partition using dd
  4. Then transferring the rootfs into remaining fifth partition using cp

Guess you could just mount mount -o loop *.img *.dir

As for size you can just resize do a fdisk get the number of sectors and DD it.

dd if=/dev/sda of=/your_directory/image_name.img bs=512 count=xxx+1

I have created a script which is not tested yet, copies the image to small image file.
I have tested to create the image, but I haven’t tested it on the Rock PI 4B device after flashing the small image it, will update once I do it.


I have stopped using images and dd because of the problems with SD cards from different manufacturers, and the enormous amount of time it takes! Also dd can overflow and gobble up your memory and crash your PC! I need 16Gb minimum, but use 32Gb for the future.

I made a tar backup of root (the entire system) on a Rock4c+, then transferred the backup to my PC. Then I restored the Debian xfce image on a suitable SD card in the normal way, power that up on the Rock4c+ to get a writable rootfs and then transfer the backup file to the SD. Then on the Rock4c+ use tar to restore everything from root. Voila, no huge image files on my PC or HD backup…