Cloning SD card and save it as an image file

Hi, I am trying to clone my 16GB SD card with DietPi and other programs installed and save it as an image file on a Win 10 PC. I thought of using Win32 Disk Imager, but it shows the SD card as two devices G: and H: How do I proceed? Here’s how the card looks:
partition

Yes this is all correct if you have a Raspberry Pi. The image contains 2 partitions. First one is a vfat partition you can mount on windows and second one is a ext4 Linux partition. Using Win32 Disk Image, you should be able to clone the whole device instead of a single partition.

1 Like

Thank you for the reply. Win32 Disk Imager shows each partition seperately in the Devices drop-down as G and H and not as a single device which is why I got confused. Wouldn’t selecting one and leaving other create an incomplete copy? How do I select both to create a unified image?

something to ask developer of Win32 Disk Imager ??

Anyway this will create a 16GB *.img file. Better to spin up a DietPi VM, connect your SD card and run our own imager tool. This would compress the image instead of creating such a huge file.

From memory, you can just select one and it will actually do the entire card.
You can check by looking at the size of the final image - if it’s 16gb then you have everything.

That said, personally I can’t get win32 disk imager to actually run on my PC any more (it looks like it runs, but nothing ever comes up) so I use USB Image Tool for the same job.

1 Like

Btw, you could use dietpi-imager from another DietPi, Debian or Ubuntu system and create an image file from the attached SD card from there. It minimises filesystem and partition automatically and compresses the image file + enables the expansion service to expand both automatically when booting from the new drive/card: https://github.com/MichaIng/DietPi/blob/7f8fe89f4e21921cc043f94cde3107e4ec682e2a/.build/images/dietpi-imager

1 Like
bash -c "$(curl -sSfL 'https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-imager')"

On nonDietPi systems it might be needed to export G_GITOWNER and G_GITBRANCH to the script

2 Likes

Like so:

bash -c "G_GITBRANCH=master G_GITOWNER=MichaIng; $(curl -sSf 'https://raw.githubusercontent.com/MichaIng/DietPi/master/.build/images/dietpi-imager')"
1 Like