Restoring an SD card using a multi-partitioned DMG I have a linux distribution that I installed on an SD card. After the lengthy installation was finished I created a DMG backup of all the partitions using the Mac's built in disk utility. The recovery image is currently 865.5MB large and seems to contain the correct information.

I am currently attempting to restore this image onto another SD card to ensure the recovery process will work appropriately. To perform this action I went into disk utility under the restore tab and entering the appropriate fields. I selected the DMG recovery file as source while selecting the SD card bay as the destination. All seemed to be working since disk manager prompted me if it was alright to fully erase the SD card as well as my root password for permissions. However, my victory was short lived as it promptly showed me this error: Recovery Error: Could not validate source - Invalid argument. I guessed that the source was incorrect, so I tried opening the DMG and providing the virtual drive as the source. However the same error persists.

Since this card contains three partitions with one being a blessed bootable partition, I would like to see if there are any ways to get my Mac to generate these for me. Since disk-utility archived the full SD card with partitions, I would assume is has a way to recover it going the other way.



Full logs from Disk Utility:

2013-01-23 19:02:27 -0500: Restore Disk
2013-01-23 19:02:27 -0500:  Source: “Raspbian.dmg”
2013-01-23 19:02:27 -0500:  Destination: “APPLE SD Card Reader Media”
2013-01-23 19:02:27 -0500:  Erase Destination: Yes
2013-01-23 19:02:27 -0500:  Erase “APPLE SD Card Reader Media” and copy the contents of “Raspbian.dmg” to it.
2013-01-23 19:02:27 -0500: 
2013-01-23 19:02:27 -0500: Starting Restore…
2013-01-23 19:02:27 -0500: Validating target...
2013-01-23 19:02:27 -0500: done
2013-01-23 19:02:27 -0500: Validating source...
2013-01-23 19:02:27 -0500: Could not detect format of volume on device ""
2013-01-23 19:02:27 -0500: Could not validate source - Invalid argument
2013-01-23 19:02:27 -0500: Could not validate source - Invalid argument
2013-01-23 19:02:27 -0500:
Use the dd command-line tool.


Mount the SD
Use "Disk Utility":  Select the top level of the SD
card and "Get Info".  Note the "Disk Identifier" (example disk13)
Unmount all of the volume on the SD, if they are mounted, but do NOT removed the SD card.  This is important because the dd will fail if it detects any mounted volumes.


In the Terminal:


If you are not in an Admin account, use "su (admin account name)" to gain admin authority
sudo dd if=/path/to/DMG/file of=/dev/(disk identifier from above) bs=16k


Then wait a long time for the operation to complete.  In a 4 GB copy I performed recently to a CF card, it took 21 minutes to finish.

You will eventually get 3 lines stating records in &amp; out and bytes copied.  Example:

243528+1 records in
243528+1 records out
3989970432 bytes transferred in 1278.252950 secs (3121425 bytes/sec)


In my case I have been copying .img files to CF cards, hopefully it works just as well for DMG's