The image you want to use when recovering should be crated earlier. The sdcard should be empty or the data on it will be lost.
First, the image should be converted to a pure image. This can be done with the following command:
hdiutil convert sdcard_image.dmg -format UDTO -o sdcard_pure_image.img
Usually the above process creates the following file sdcard_pure_image.img.cdr
.
Use the following command to change the extension (You can skip this step, but the rest of the commands should be adjusted.)
mv sdcard_pure_image.img.cdr sdcard_pure_image.img
Then you have to find the correct device id. This can be done using the Disk Utility
app. Select the mounted card and check what's written next to Device
label.
It should be something like diskX
, where X
is a number.
! Create a backup of the sdcard information. Don't forget to unmount the sdcard (don't eject it).
Use the following command to start the cloning process:
sudo dd bs=2048 if=sdcard_pure_image.img of=/dev/diskX
Once the process finishes, the sdcard should contian the image. Keep in mind that the size of the image and the card should match or the card size should be larger.