How to mount a DMG image on macOS 10.15.5 that was generated by GNU's ddrescue?

I used the following command in order to save some time (-n and -N options):

sudo ddrescue -v -n -N /dev/disk5 /Volumes/formatted/photosound.dmg /Volumes/formatted/map.txt

With the help of Disk Arbitrator, I made sure that the corrupted drive (disk5) did not mount in the macOS. The target disk (1TB larger than the corrupted drive) is normally mounted.

The command above terminated successfully, however when I double-click on the .dmg file, it says it can not mount:

enter image description here

So how can I mount this image? Or is the command wrong? Please help! I wished that ddrescue would first try to create an empty mountable image without any data in it (this should take about 1min to recover). Then it should be possible to just add data to the image...


Solution 1:

ddrescue doesn't create DMG files. Just appending .dmg to a file doesn't a DMG make.

A DMG is an Apple Disk Image file. There are methods to create a DMG on other platforms besides macOS - How to build a dmg Mac OS X file (on a non-Mac platform)? - but you must have the ability to format the volume as HFS+ (at a minimum). The command you used doesn't show where that was done.

You might also want to review how to create a DMG: How do I create a DMG file from a directory? on macOS