Issues creating an image-file from a SD-card

Hello.

I have succesfully converted Buster-based ARMbian-Images to DietPi using the very nice “Other device”-instruction:
An Orange Pi Zero and an Banana Pi M2+ are running nearly fine now.

But I have discovered two problems:

  • Before starting the converted DiePi I made an Image-file with Win32DiskImager. As I only have 32GB SD-cards the
    .IMG-file went 32GB big, but after zipping it the file size was below 2GB. Is there a way/tool to create an .IMG-file
    which only uses the space really used on the SD-card (pure .IMG-file, no extra zipping)?

  • When i wrote this .IMG-file to another SD-card with a capacity of also 32GB using W32DiskImager and balena Etcher
    both programs stated that I would need a little more space on the target SD-card. How is that possible?

So: How do I create an .IMG-file with minimum-size and compatible to other SD-card capacities?


Cheers,
Lelo

For the image creation DietPi use following script.

bash -c "$(curl -sSL https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-imager)"



  1. install Debian base image
  2. run the PREP script
  3. shutdown that device
  4. take out SD Card
  5. mount SD Card on a different DietPi device or DietPi VM
  6. run dietpi-imager script
  7. Select Drive as source
  8. select dd as cloning tool, DO NOT select Clonezilla installer, since this only works for x86_64 target systems
  9. select external usb drive
  10. select rootFS
  11. specify file name
  12. be patient, creation of the image will take some time

Thanks for your response, but I don´t succeed with this:
I have a Windows-laptop with an “Linux Mint XFCE” installed in VirtaulBox. It looks like a USB3-Port is not supported in VB,
but connecting the carderader to a USB2 port shows me the SD-card mounted in Thunar-filemanager.

I opened a terminal, entered the command you stated (with & without sudo) and got this reponse ("–>" = translation):

sudo bash -c "$(curl -sSL https://raw.githubusercontent.com/MichaIng/DietPi/dev/.meta/dietpi-imager)"
[sudo] Passwort:     
bash: Zeile 19: /boot/dietpi/func/dietpi-globals: Datei oder Verzeichnis nicht gefunden ---> File or directory not found
bash: Zeile 21: G_CHECK_ROOT_USER: Befehl nicht gefunden ---> command not found
bash: Zeile 22: G_CHECK_ROOTFS_RW: Befehl nicht gefunden ---> command not found
bash: Zeile 24: G_INIT: Befehl nicht gefunden ---> command not found
environment: Zeile 59: G_WHIP_MENU: Befehl nicht gefunden ---> command not found

Where did I go wrong?

You would need to have a virtual machine running DietPi :wink:
Should not be a problem on Virtual Box :sunglasses:

Ah, OK, I thought “some DD-scripting” would do well with any linux.
Worked with VBox and the Dietpi-PC-Image fine then. Thanx for your support. :slight_smile:

yes, dietpi-imager is expecting a couple of DietPi functions (G_) as you can see on your error message

Hello, I am a fresh fan of dietpi. I liked dietpi for its minimization while having intuitive and automatic configuration tools.
I would like to make a clean system image using dietpi-imager for OdroidU3 and I am following the instructions exactly. I encountered this error:

DietPi-Imager: mount /dev/sdb2 /tmp/DietPi-imager_mnt
enviroment: line 433: 1968177152 bytes (1.83GiB) + 4*1024 : syntax error in expression (error token is "bytes (1.83GiB) + 4*1024**2 ")

Welcome to our community.

Can you be a little bit more specific at which step you are facing the issue

I have a issue at the step 12.

Does anyone have any ideas what is going on?

I also have a question. Does DietPi-imager create an image of the system with all user data and loaded applications, or in a raw installer clean system?

It creates an image from everything on the drive, everything you installed and created.
If you want a clean fresh system, then download the image from the website :wink:

Yes, it is a full image of the existing system.

I know but the problem is I have DietPi from Other System dietpi-installer from custom Debian Bullseye XFCE for Odroid U3 and I made some changed to good working on OdroidU3 and I would like to make clean fresh system for the others for this board. :wink: I made uncompressed image installer version on with dd on the console and now with instruction I would like to use dietpi-imager just fot the others. :wink:

The imager script will not create a clean image. It will take the system as is. basically do the same as using dd command. What we do in addition is to shrink and compress the IMG file.