1

I have read that this is possible on Windows using Win32DiskImager.exe but I'm looking for a Linux (Mint) based solution. I have downloaded the latest distribution and configured it with the software I need and now I'd like to make a *.img file of it - ideally with the ability to not include unallocated sectors as Win32DiskImager.exe apparently does. Is this possible on Linux?

Thanks, Dave

  • 1
    "ISO" is much abused term; it really refers to a CD/DVD specific image. There is not much point to such in a Raspberry Pi context. However, it is often used synonymously with device image, since once upon a time the only kind of device image most people ever encountered was an image.iso file. Notice that Pi images use the prefix .img. See also: https://raspberrypi.stackexchange.com/a/51100/5538 – goldilocks Feb 02 '19 at 19:38
  • I have corrected it. Still need to find how to do it. I know there are utilities such as mkisofs but the Raspberry Pi has two separate partitions and I'm not sure how to handle that. – David Harper Feb 03 '19 at 20:12
  • The headline is still confusing. – Ingo Feb 03 '19 at 20:49

1 Answers1

2

To create a complete image of a SD Card on a Linux system you can use the dd program. It will copy bit by bit from the SD Card into a file so the file will get the same size than the SD Card. How to do it you can look at
raspberry pi compute module replication.

Fortunately you can compress the image to about one sixth of size for example with most used gzip:

pc ~$ gzip sdcard.img

This will make a compressed image sdcard.img.gz. You can also use the power of the Unix command line and pipe the commands to one command, for example using the instructions from the linked answer:

pc ~$ sudo dd if=/dev/sdb bs=4M | gzip > sdcard.img.gz

To restore it you use:

pc ~$ gzip --decompress --stdout sdcard.img.gz | sudo dd of=/dev/sdb bs=4M conv=fsync
Ingo
  • 42,107
  • 20
  • 85
  • 197