Unable to mount a HFS+ image due to error on loop

0

I am trying to mount an image of a macbook pro obtain with dd. I have use this strategy to adapted the syntax of my mount command.

I have use the following process

  • create the image: sudo dd if=/dev/sdc of=ddDisk bs=300M status=progress
  • obtain the property of the image with fdisk -l and testdisk (see below)
  • create an empty directory: mkdir test
  • try to mount the main partition (ddDisk2) with the following command: sudo mount -v -t hfsplus -o sizelimit=498887294976 ddDisk2 test

I obtain the following error message: mount: test: failed to setup loop device for ddDisk2. I am not sure I well understand this message.

Results of fdisk -l

Disk ddDisk: 465,8 GiB, 500107862016 bytes, 976773168 sectors 
Units: sectors of 1 * 512 = 512 bytes 
Sector size (logical/physical): 512 bytes / 512 bytes 
I/O size (minimum/optimal): 512 bytes / 512 bytes 
Disklabel type: gpt 
Disk identifier: C83292DE-1D21-4967-8FCA-2A6C377E6F39

Device         Start       End   Sectors   Size Type 
ddDisk1          40    409639    409600   200M EFI System 
ddDisk2      409640 975503591 975093952   465G Apple Core storage 
ddDisk3   975503592 976773127   1269536 619,9M Apple boot

Results of testdisk

TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Disk ddDisk - 500 GB / 465 GiB - CHS 60802 255 63
     Partition               Start        End    Size in sectors
>P EFI System                    40     409639     409600 [EFI]
 P Mac HFS                   409640  974798887  974389248
 D Mac HFS                975503592  975765735     262144
 D Mac HFS                975503592  976773127    1269536

Guuk

Posted 2018-11-27T08:58:55.580

Reputation: 179

Answers

0

Mount only the partition, not the whole image.

losetup -f /dev/loop4 ddDisk -o 209735680
mount -t hfsplus /dev/loop4 test

(209735680 is the first byte of the partition)

Ipor Sircer

Posted 2018-11-27T08:58:55.580

Reputation: 3 578

Thank you for your reply but I obtain the following error losetup: /dev/loop4: failed to set up loop device: Invalid argument – Guuk – 2018-11-27T09:11:05.183

Then try lower free loop device, e.g. loop1. (ls /dev/loop*) – Ipor Sircer – 2018-11-27T09:12:26.033

And make sure loop module is loaded to kernel. (modprobe loop) – Ipor Sircer – 2018-11-27T09:13:21.590

I have tried on loop0: losetup: /dev/loop0: failed to use backing file: Cannot allocate memory – Guuk – 2018-11-27T09:22:48.827

modprobe loop returns nothing – Guuk – 2018-11-27T09:23:02.250