Mounting disk images on macOS

I never can remember those commands. So here is my memory aid.

Mount an ISO disk. It usually gets mounted in /Volumes already.

$ hdiutil mount backupdisk.iso

Mount a RAW image disk. This gets a bit more complex – we attach the image without mounting it. hdiutil spits out the partitions on that image and we finally mount the needed partition only.

$ hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount backupdisk.img
/dev/disk5            FDisk_partition_scheme
/dev/disk5s1          Windows_FAT_32
/dev/disk5s2          Linux
$ mount_msdos /dev/disk5s1 ~/test

After use of the content of the image detach it with hdiutil.

$ hdiutil detach disk5
"disk5" unmounted.
"disk5" ejected.

Leave a Comment