0

a few years ago, when I created my Raspbian SD card from a downloaded Raspbian iso file, it created two partitions - boot and data.

Now I want to clone what I have into a larger SD card. How can I create a single iso file with the dd command, or anything native to Linux? I have no Windows PC to run win32imager.

thanks much!

Ben Z.
  • 1
  • 1
  • 1
  • You cannot create an **iso** file with `dd`. You can only create a raw bit copy image of the source. – Ingo Jul 12 '20 at 17:48

3 Answers3

3

How can I create a single iso file with the dd command, or anything native to Linux?

If the SD card is /dev/sda:

dd if=/dev/sda of=myimage.img bs=4M

Couple of points:

  • That's sda, not sda1, which if there are two partitions there will also be an sda2 but you want the device itself, not a partition on it. Similarly if it is /dev/mmcblk0 -- which maybe confusing because of the 0, but the partitions are /dev/mmcblk0p1 and p2. Again, you want the plainmmcblk0.
  • It's best to do this with the partitions unmounted, although that's not strictly necessary. If you need to do it with the running Pi itself, you can, but you will end up with the potential issues mentioned here WRT to excluding certain directories.1
  • The file extension can be .iso if you want although strictly speaking this is a bit of a misnomer. Historically it refers to images that are formatted for use on a CD-ROM, which this is not -- hence .img. It doesn't really matter except in so far as some tools for burning an image might not recognize it as such.

  1. Read from the second paragraph which begins, "You actually do not want a complete copy of a running system as a back-up" -- this applies to an image as well. The best thing to do if at all possible is not do it from the running system.
goldilocks
  • 56,430
  • 17
  • 109
  • 217
2

You can create an image (not ISO) as in Goldilocks Answer.

If all you want to do is create a copy to a SD Card you can do this on the Pi itself using the SD Card Copier included in Raspberry Pi OS. This will automatically resize to a larger (or smaller) card.

Milliways
  • 54,718
  • 26
  • 92
  • 182
2

SDCARD copier can be used(It comes with Raspbian) in this situation if you want to take a backup of your system. It takes a lot of time though.

Sohan Arafat
  • 1,770
  • 1
  • 9
  • 37