Advertisement
MrRockchip

Mac mounting

Nov 6th, 2016
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1.  
  2. http://superuser.com/questions/961401/mounting-hfs-partition-on-arch-linux/1088110#1088110
  3.  
  4. TestDisk 7.0, Data Recovery Utility, April 2015
  5. Christophe GRENIER <grenier@cgsecurity.org>
  6. http://www.cgsecurity.org
  7.  
  8. Disk /dev/sda2 - 256 GB / 238 GiB - CHS 31123 255 63
  9. Partition Start End Size in sectors
  10. >P Mac HFS 32119 499306870 499274752
  11.  
  12.  
  13. [owner@macf ~]$ sudo fdisk -l /dev/sda2
  14. Disk /dev/sda2: 238,4 GiB, 256000000000 bytes, 500000000 sectors
  15. Units: sectors of 1 * 512 = 512 bytes
  16. Sector size (logical/physical): 512 bytes / 4096 bytes
  17. I/O size (minimum/optimal): 4096 bytes / 4096 bytes
  18.  
  19. 4096 * 499274752 = 2045029384192
  20. 2045029384192/8 = 255628673024
  21.  
  22. sudo mount /dev/sda2 -t hfsplus -o ro,sizelimit=255628673024 /mntosx
  23.  
  24. =====
  25.  
  26.  
  27.  
  28. It's likely that the HFS volume is not mounting because the HFS partition is wrapped in a CoreStorage volume (the default since OS X 10.10). You can verify if this is the case with the output of fdisk -l: fdisk output
  29.  
  30. HFS+ uses two volume headers, one 1024 into the device and the secondary 1024 from the end of the device. Per the spec, when mounting a partition the secondary header is expected to be to be exactly 1024 bytes from the partition's end, but with CoreStorage wrapping the HFS volume that's no longer the case so it aborts. You can pass -o sizelimit=N to mount to manually specify the HFS volume size and fix this, but how does one get the magic value for N?
  31.  
  32. The testdisk utility can scan for partitions, hinting at where the HFS partition really ends. Be wary - selecting the wrong options in testdisk can damage your partition table!
  33.  
  34. Launch TestDisk with testdisk /dev/sdX, and then OK to select the drive
  35. Select Intel for MBR or EFI GPT for GPT formatted drives
  36. Press Analyse and then Quick Search
  37.  
  38. After a few moments it should print it the partitions found: testdisk results
  39.  
  40. The partition indicated looks awfully close to (but slightly smaller) than the real partition size of 623463232 sectors reported by fdisk -l earlier.
  41.  
  42. Because the TestDisk output uses sectors, we'll need to multiply it by the drive's physical sector size (typically 512 or 4096 bytes) to get the HFS volume size in bytes. That's the value for N we'll use for -o sizelimit=N when mounting the HFS volume.
  43.  
  44. If you don't know your drive's sector size, check the output of the second number reported by fdisk -l: finding your disk's physical sector size
  45.  
  46. Press q several times to exit the program
  47. Mount the disk: mount /dev/sdXn -t hfsplus -o ro,sizelimit=N
  48.  
  49. shareimprove this answer
  50.  
  51. edited Jun 11 at 18:55
  52.  
  53. answered Jun 11 at 18:44
  54. Stewart Adam
  55. 11626
  56.  
  57. 1
  58.  
  59. From user edmonde: This recipe worked great for me, but I had to tweak it using the logical sector size (the first of two numbers, in my case 512 versus 4096) as opposed to the physical sector size to calculate the total volume size. I'm not sure why but it worked great. – fixer1234 Jul 6 at 18:51
  60. 1
  61.  
  62. Yes, this! This 100 times over! I too had to use the logical size when doing my calculations. Worked like a charm. Thanks! – Michael Ambrose Aug 30 at 14:57
  63.  
  64.  
  65. This fixed my problem. Other resources suggested using an offset parameter, which didn't work when combined with this, but using only sizelimit set to the number of bytes (bytes * sectors) worked like a charm, even for non-CoreStorage partitions – cdeszaq Oct 16 at 16:58
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement