Linux – How to mount an OSX dd disk image

My 2011 Mac Mini was running so slowly, that I decided to back up it’s entire hard disk, and switch to Ubuntu. For the backup process, I opted to boot into a live Ubuntu environment, then use dd to copy the entire hard drive to a USB external hard drive. I can’t remember the exact command, but it was something to the extent of–

After ~5 hours, my new disk image was created on the USB HDD mounted at /media/ubuntu/usbhdd. Before deleting all the contents of the Mac Mini’s hard drive, I wanted to make sure the disk image was good, so I needed a way to mount the partitions that existed inside apple-dapple-2016-sept-03.img. I unmounted the USB HDD from the Mac Mini, and connected it to my laptop. On my laptop, as you’ll see below, the USB HDD was mounted to /media/chris/backup


I’m not sure this is actually needed, but I’m putting it here just in case.

Mounting process

I started by making a mount point. This is where I mounted the filesystem to, so that I could browse to this directory and see all the files in the partition.

Next I needed to list the partitions on the dd image. fdisk won’t do, because fdisk doesn’t support GPT partition tables. Here I used parted. Setting the unit to B in parted was important, because the mount command expects offsets and sizes in bytes, not sectors.

Using this output, I needed to find the start byte offset of the partition I wanted to mount, along with that partition’s total size. All my data was on the partition named, “Customer” and it starts at 209735680 (209735680B). Using that byte offset & byte partition size 471290851328, I was able to mount it.

Now I was able to browse the files, and copy whatever I needed from the partition. It worked!

This process took a lot of research. Lots of blogs and stackexchange answers instructed to specify a byte offset as an option for the mount command, but did not mention a sizelimit. I originally specified the byte offset, but not the sizelimit, so that resulted in an error–

Following the instructions in the above error message, I saw these lines in the output of dmesg

And that’s what led me to the solution. This Superuser question about that same error.