1

Hie

I have an SD card Module and can access connect two SD cards to my raspberry pi, however i would like to be write an image in the other card connected to the SD Card Module

Milliways
  • 59,890
  • 31
  • 101
  • 209
Tawanda
  • 13
  • 2
  • 1
    Hello, what commands have you already tried and did you get any errors? Add this information to your question. Your question is a little open ended at the moment as its not clear if you are just asking how to write an image to an SD card or that you tried but are having problems. – Roger Jones Nov 18 '19 at 13:01
  • I want to write an image to an SD Card. The image files are stored on a raspberry pi and i want to write them to the SD card connected to a raspberry Pi through an SD card module – Tawanda Nov 18 '19 at 13:13

1 Answers1

1

You'll need to identify the device node representing the card. Understanding the difference between a block device, a device partition, and a filesystem is probably a good thing at this point. The device node is not a mount point. If there are no other storage devices attached to the Pi, it will probably be /dev/sda. Note for emphasis in case you did not read that link: not /dev/sda1.

Then if the image is raspberrypi.img:

sudo dd if=raspberrypi.img of=/dev/sda bs=4M status=progress

That will take a few minutes.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • I understand the device node representing the card is a block device. Now i want to know is if it is possible to have a program like win32 disk imager runninh on the raspberry pi so i can use it to write new images to the SD card connected via an SD Card Module – Tawanda Nov 18 '19 at 13:32
  • 1
    Yes. This is the most bulletproof method; if you want a GUI instead it is only going to get more complicated, not less. – goldilocks Nov 18 '19 at 13:59
  • One user on the forums recently managed to get balenaEtcher to run on a Pi . I prefer using it than dd because Etcher verifies after flashing. – Botspot Nov 18 '19 at 14:41
  • Looks "more complicated" to me. I'd presume some frontend to gparted could do this too, although I have never tried. If you want to validate cmp raspberrypi.img /dev/sda should do it -- not sure if it will "fail" at the end of the image if reading /dev/sda does not end with EOF, but probably not and if so that is not a real problem: https://unix.stackexchange.com/q/29921/25985 – goldilocks Nov 18 '19 at 14:47