# Issues creating an image-file from a SD-card

**URL:** https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305
**Category:** General Discussion
**Created:** [15 July 2020 19:08 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305 "2020-07-15T19:08:13Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Lelo](https://dietpi.com/forum/user_avatar/dietpi.com/lelo/32/4425_2.png) [@Lelo](https://dietpi.com/forum/u/Lelo)
#### Post date: [15 July 2020 19:08 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/1 "2020-07-15T19:08:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [15 July 2020 22:05 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/2 "2020-07-15T22:05:02Z")

</div>

For the image creation DietPi use following script.

```nohighlight
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

---

<div class="post-metadata">

### Author: ![Lelo](https://dietpi.com/forum/user_avatar/dietpi.com/lelo/32/4425_2.png) [@Lelo](https://dietpi.com/forum/u/Lelo)
#### Post date: [16 July 2020 15:02 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/3 "2020-07-16T15:02:24Z")

</div>

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):

```nohighlight
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?

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [16 July 2020 15:04 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/4 "2020-07-16T15:04:58Z")

</div>

You would need to have a virtual machine running DietPi 😉  
Should not be a problem on Virtual Box 🕶

---

<div class="post-metadata">

### Author: ![Lelo](https://dietpi.com/forum/user_avatar/dietpi.com/lelo/32/4425_2.png) [@Lelo](https://dietpi.com/forum/u/Lelo)
#### Post date: [16 July 2020 19:36 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/5 "2020-07-16T19:36:54Z")

</div>

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. 🙂

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [17 July 2020 00:37 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/6 "2020-07-17T00:37:08Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Krotosz6](https://dietpi.com/forum/user_avatar/dietpi.com/krotosz6/32/2581_2.png) [@Krotosz6](https://dietpi.com/forum/u/Krotosz6)
#### Post date: [11 September 2022 06:38 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/7 "2022-09-11T06:38:34Z")

</div>

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:

```auto
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 ")

```

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [11 September 2022 07:00 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/8 "2022-09-11T07:00:27Z")

</div>

Welcome to our community.

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

---

<div class="post-metadata">

### Author: ![Krotosz6](https://dietpi.com/forum/user_avatar/dietpi.com/krotosz6/32/2581_2.png) [@Krotosz6](https://dietpi.com/forum/u/Krotosz6)
#### Post date: [11 September 2022 07:12 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/9 "2022-09-11T07:12:15Z")

</div>

I have a issue at the step 12.

> [@Joulinar](#):
>
> 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

---

<div class="post-metadata">

### Author: ![Krotosz6](https://dietpi.com/forum/user_avatar/dietpi.com/krotosz6/32/2581_2.png) [@Krotosz6](https://dietpi.com/forum/u/Krotosz6)
#### Post date: [13 September 2022 09:55 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/10 "2022-09-13T09:55:26Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [13 September 2022 10:00 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/11 "2022-09-13T10:00:10Z")

</div>

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 😉

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [13 September 2022 11:57 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/12 "2022-09-13T11:57:42Z")

</div>

> [@Krotosz6](#):
>
> Does DietPi-imager create an image of the system with all user data and loaded applications

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

---

<div class="post-metadata">

### Author: ![Krotosz6](https://dietpi.com/forum/user_avatar/dietpi.com/krotosz6/32/2581_2.png) [@Krotosz6](https://dietpi.com/forum/u/Krotosz6)
#### Post date: [15 September 2022 11:04 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/13 "2022-09-15T11:04:15Z")

</div>

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. 😉 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. 😉

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [15 September 2022 12:20 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/14 "2022-09-15T12:20:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mohammadazeemwani](https://dietpi.com/forum/user_avatar/dietpi.com/mohammadazeemwani/32/7080_2.png) [@mohammadazeemwani](https://dietpi.com/forum/u/mohammadazeemwani)
#### Post date: [12 November 2024 11:43 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/15 "2024-11-12T11:43:52Z")

</div>

suppose i worked on a diepi vmware installation  
and make everything up to date

does it means that using dietpi-imager i can create .img from vmware  
and burn it to sd card and it will work exactly on an actual Pi

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [12 November 2024 11:56 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/16 "2024-11-12T11:56:45Z")

</div>

No, the Pi uses ARM architecture while your VM is probably x86\_64.  
It’s like trying to run a windows on a RPI.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [12 November 2024 14:27 UTC](https://dietpi.com/forum/t/issues-creating-an-image-file-from-a-sd-card/4305/17 "2024-11-12T14:27:20Z")

</div>

> [@Jappe](#):
>
> It’s like trying to run a windows on a RPI.

not the best example, [https://www.makeuseof.com/how-to-install-windows-10-and-11-on-a-raspberry-pi-4-the-easy-way/](https://www.makeuseof.com/how-to-install-windows-10-and-11-on-a-raspberry-pi-4-the-easy-way/) 🤣

But yes, you can’t use a VM image on a RPi due to different CPU architectures.
