Posts: 8
Joined: Thu May 16, 2013 9:42 pm

DMG image to SD Card on OS X

Mon Feb 03, 2014 10:29 pm

Hey All,

In my cheap attempt to not use up too many SD cards while working on multiple RPi projects, I created an image of a configured RPi's SD using MacOS X's Disk Utility (GUI). This saved it as a DMG file that mounts nicely on the Mac when I double-click it. I wiped the card to use it for another project with plans to eventually come back to the project saved on the image.

So the day has come when I want to come back to working on the first project and I've been unable to write the saved DMG image to an SD card. I've been using dd on the command line with various buffer sizes. The job completes, but I can never get the card to mount afterwards. I've always started by wiping the card so it's fresh. I've tried two different cards to rule out hardware failure. I've also tried doing this via the GUI Disk Utility itself, but it always throws the "Restore Failure Could not validate source - invalid Argument" error.

It's starting to look like I should have used dd to create the image in the first place, but that ship has sailed and I'm now looking for the best way to recover my work.

Is there a reliable way to make a dmg image properly write to an SD card on a Mac, or am I going to need to resort to copying my project over file by file and attempt to re-create the various Linux configuration changes?

Any tips would be greatly appreciated!


Posts: 7993
Joined: Wed Jan 25, 2012 6:39 pm

Re: DMG image to SD Card on OS X

Mon Feb 03, 2014 11:16 pm

I know almost nothing about any Apple product so the following is just from searching the net.

According to

"Apple disk image files are essentially raw disk images (i.e. contain block data) with some added metadata, optionally with one or two layers applied that provide compression and encryption."

So not surprising that you are not succeeding when 'dd'ing the files to SD cards.


".dd/.cdr (raw image)

These files are raw dumps, as the dd program uses them.
You can convert .dmg files to these on the Mac, using the following command:
hdiutil convert some.dmg -format UDTO -o some.dd
hdiutil uses the suffix ".cdr" for these files, but in fact the result is a raw dump that can be used with standard, cross-platform tools such as dd. This is why we prefer the ".dd" suffix.

To write a raw dump to a physical disk:
CAUTION: the following commands are dangerous. You might accidentally wipe your hard disk.
Do not use this if you do not know what you are doing.
On the Mac, it can be written with
dd if=some.dd of=/dev/rdiskX bs=2048"

So try converting and then 'dd' ing to an SD card.

Posts: 8
Joined: Thu May 16, 2013 9:42 pm

Re: DMG image to SD Card on OS X

Sun Feb 09, 2014 6:38 am

That worked! I bow to your superior Googling skills.

Thank you.

Posts: 1
Joined: Mon Sep 07, 2015 9:53 pm

Re: DMG image to SD Card on OS X

Mon Sep 07, 2015 9:56 pm

Thank you that was helpful. My wife had grown tired of hearing me curse the error messages. She thanks you...

Return to “Troubleshooting”

Who is online

Users browsing this forum: asavah, bob_binz, crofter, epoch1970, gkaiseril, leptonfarm and 8 guests