The disk image has become ubiquitous in the computing world. It is basically a virtual hard drive that lets you store and retrieve data just like the real thing. The reason it has become so popular is that it gets treated as a single file by the operating system. This makes disk images easy to move, transfer from machine to machine, and download. It can also make complex installs easy, as a disk image can be a clone of an install DVD for an application or a game. They are pretty rock solid but, like all things downloadable, sometimes they do get corrupted.
If you are lucky you have never clicked on a disk image and seen the message “Error- no mountable file systems found”. If you have, you know the usual solution is to re-download the image. If the image is something small like Firefox the process is pretty painless and only takes a few minutes. If, however, it’s the copy of Adobe Creative Suite that took six hours to download and kept you from doing anything else internet-based while it did it’s definitely less trivial and probably elicits some unfriendly language pointed towards the gods of the internet.
After going through this numerous times myself, including once with a backup of my home machine that had taken hours to do, I decided to see if there was any other way to approach the problem. All my usual directory tools such as disk utility and Disk Warrior had failed, as had the terminal command hdiutil attach
There are three basic steps:
1) Create the device node. The important part is to skip the parts that disk utility does automatically, which is to verify and try to mount the volume. Disk utility tries to verify and mount by default, and will fail to mount your image if either of those tasks fail:
hdiutil attach -noverify -nomount disk.dmg
Where disk.dmg is the name of the image.
2) Then run:
diskutil list
This will give you the name that the OS has given your drive. It will be in the form diskN, where N is a positive number.
3) Finally, attempt to mount the device:
diskutil mountDisk /dev/diskN
where diskN is the number you noted before.
This mounts the disk itself, instead of attempting to mount a volume which in our case is bad and will not mount through Disk Utility. Many times this is all that is needed, and the image can be opened and used normally. If not, directory repair tools such as Disk Warrior can now be used, as they can see the virtual drive to work on it. I have used this to save time on big downloads, but more importantly it has saved customer data because data coming from failing drives can be so corrupted it breaks the disk image we are attempting to write to in the recovery. I hope this helps if you run into this issue.