Tools/tips to recover data from a corrupt DMG disk image?

8

5

Please share, if you know any tips to salvage data from a "compressed DMG" which no longer mounts (in my case, something went wrong during "scan image for restore").

username

Posted 2009-07-29T02:10:03.923

Reputation: 1 178

Answers

7

Answering my own question here with a list of things to try.

  • Disk Utility > First Aid > Repair Disk
  • Disk Utility, try converting the image to an ISO
  • try using 3rd party utility to convert the image, such as "dmg2iso" (sometimes this has a side effect of ignoring corrupt data, and the image will mount)
  • try mounting with 3rd party utility such as Toast
  • hdiutil attach -ignorebadchecksums /Volumes/path/to/image
  • hdiutil mount -nomount -readwrite /Volumes/path/to/image (then try repair using DiskWarrior, etc)

I'll probably be fleshing this list out over the next week as I do more research. I want to take a look through these sites:

username

Posted 2009-07-29T02:10:03.923

Reputation: 1 178

5

I found the following command to work on salvaging a corrupted dmg image. The solution started from reading your problem. I looked for a solution for three days.

hdiutil convert imac.dmg -format UDTO -o output.img

Background: I had used diskutil on OSX 10.8.2 to create an image of my iMac's internal drive. I transferred it up to my server and when I went to restore it to another disk it would not mount saying there were no valid file systems. I was devastated as I had too much confidence in the image and got rid of my timemachine images to save space. Okay I am a moron who should know better!

I googled the error and found this discussion. I tried all of the items and was not able to mount the dmg file. I knew the the image was basically good by running

hdiutil imageinfo imac.dmg which gave promising results:

Format Description: UDIF read-only compressed (zlib)
Class Name: CUDIFDiskImage
Checksum Type: CRC32

From a link provided in this thread http://discussions.apple.com/thread.jspa?threadID=1218394

I found a reference to http://vu1tur.eu.org/tools/ for dmg2img which DMG2IMG is an Apple's compressed dmg to standard (hfsplus) image disk file convert tool. I went to the read me file for the tool which had this note:

1. An equivalent command under Mac OS X would be:
    hdiutil convert <input.dmg> -format UDTO -o <output.img>

And that turned out to be the solution. I was able to mount the output file, which was the right size, 200GB, and extract the files I needed!

SUCCESS!

nworker

Posted 2009-07-29T02:10:03.923

Reputation: 51

Brilliant; got the same issue (curse you, OSX Disk Utility restore feature...); after the conversion I was able to get the image and restore it. I suspect my image was compressed, since it end up being twice as big as the original DMG file. – rataplan – 2014-11-27T02:52:17.497

3

I had to use the -noverify and -mount suppressed flags to get my disk to mount. Without those flags, the errors kept causing the mount to abort. After mounting in this way, I was able to select a blank entry in the Disk Warrior drop-down and recover the majority of my files.

hdiutil attach -noverify -mount suppressed /Volumes/path/to/image

Eric Wilcox

Posted 2009-07-29T02:10:03.923

Reputation: 31

1

DiskWarrior can be used to rebuild some corrupt disk images, depending on the nature of the corruption. Might be worth a shot if you have a copy.

Brian Webster

Posted 2009-07-29T02:10:03.923

Reputation: 364

-1

Most probably, it is dead beyond repair.

You will need to download or obtain it again.

Josh Hunt

Posted 2009-07-29T02:10:03.923

Reputation: 20 095

1How can you tell that is broken beyond repair? I had the same issue and converting the image fixed the issue. An attempt is always a good thing to do, before give up :) – rataplan – 2014-11-27T02:50:48.407