How do you access the contents of a mounted DMG drive mounted through hdiutil and diskmout

34,059

Solution 1

Thanks to @slhck, I was able to see that actually my disk image was not mounted. His assistance helped me confirm that.

Initially I carried out these commands to overcome a no mountable files error:

hdiutil attach -noverify -nomount name.dmg
diskutil list
diskutil mountDisk /dev/disk4

then received the following message:

Volume(s) mounted successfully

This apparently did not work. So there were no files for me to browse through. Here is what I did to solve my main and 1st problem.

I see that in other posts in this site some suggested that we should convert name.dmg to writable file to overcome a no mountable files error in a name.dmg file.

I used the command from Terminal to convert but was not successful. Instead, I used Disk Utility, attached the Volume (yes I got the same message again, "no mountable system files") however, Disk Utility nevertheless attached the image, which I was able to do before anyways.

This time, I selected it and then clicked New image, and then selected Image Format » Read/Write, not the compressed option.

I created a new image. This time this image was writable however, it still would not mount using -noverify -nomount. However, this time I was able to scan it with Disk Drill with exact file locations and folder hierarchy as I had. Recovering all from thereon was a breeze.

Just remember: when you create new image of an attached volume and don't choose Compressed but Read/Write, you need to have a disk with exact amount of space that totals the total space allocated within that name.dmg file – not the amount of space the data takes.

Mine was huge, and luckily I had an external disk with enough space to do that and it took about 5 hours for about 400 GB of disk allocation. I have all my files now. Thank you all.

Solution 2

Open DiskUtility and go to the Images menu and select Convert…

Choose the unmountable DMG image and convert it to a read/write image or a DVD/CD master.

After ends you can mount it.

Share:
34,059

Related videos on Youtube

A. O.
Author by

A. O.

Updated on September 18, 2022

Comments

  • A. O.
    A. O. almost 2 years

    My external USB drive failed. I made a .dmg image file of the drive using disk utility. Later I was not able to mount the .dmg image. I used terminal

    hdiutil attach -noverify -nomount name.dmg
    diskutil list
    diskutil mountDisk /dev/disk4
    

    then received the following message:

    Volume(s) mounted successfully
    

    However, I cant see the drive or access its contents through Finder. Disk Utility shows the drive as ghost but I still cant mount it using diskutility. Terminal tells me that the drive is mounted and constantly shows it in the diskutil list.

    pwd is not the mounted .dmg image. I don't know how to enter into the mounted image drive to see its contents. So in case what I said sounds like I see the files in the mounted image no this is not the case. I do not know how to access or even change the pwd within Terminal. I was hoping to see the mounted drive through Finder but I do not see that.

    So I need help as to how to find a way to access the mounted image drive if it was really mounted.

    Terminal says that it was and it shows it under diskutil list as a /dev/disk4.

    Can someone please help me access the files on this drive?