HFS+ partition not readable, 2TB only shown as 250gb

1

I recently transferred a whole bunch of data onto a HFS+ hard drive as a backup for a reinstall of a Mac machine. After the reinstall was done, I wanted to load all the data back onto my machine. The (external) hard drive was not recognized by the machine anymore though.

  • Connected to the MacOS machine via USB 3, it doesn't show up anywhere, diskutil, system report, nothing.
  • removing the drive and placing it into a Debian system directly via SATA, a partition gets recognized, but its 250GB large instead of 2TB. It cannot be read from or mounted

__

output of fdisk -l:

Disk /dev/sdb: 1,8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start       End   Sectors   Size Id Type
/dev/sdb1           2 488378644 488378643 232,9G af HFS / HFS+

Partition 1 does not start on physical sector boundary.

And this is what the GUI shows me on Debian

Disk Tool screenshot

I am suspecting (and hoping) something went wrong with the partition table or something similar that can be reconstructed. Anyone has any ideas? Unfortunately, there are 500gb of private memories on this drive and my NAS failed a few days earlier, which is why this was my last backup... I was getting ready for the new NAS :-X

thanks, Pascal

macos
hard-drive
partitioning
asked on Super User Apr 17, 2017 by pascalwhoop

1 Answer

2

At least part of your problem is likely caused by sector-size issues. The vast majority of hard disks use 512-byte logical sector size on their native (usually SATA) interfaces. (Note that the "physical" sector size reported by fdisk is irrelevant to this discussion.) Many external USB enclosures "translate" sets of eight 512-byte sectors into one 4096-byte sector. This enables over-2TiB disks to be used with the old Master Boot Record (MBR) partitioning system, and I suspect it's also necessary to fully address the disks over a USB interface, at least with certain enclosures.

Thus, I think that what happened was that your disk was partitioned via a USB interface that did this translation, which meant that your disk had approximately 488,378,646 4096-byte sectors; however, when you plugged it directly into a computer's SATA port, it was read as having 3,907,029,168 512-byte sectors. (That value's from your fdisk output.) The partition table was written with the assumption of fewer but bigger sectors. Because partition tables record partition starting points and sizes in number of sectors but don't provide any hint about the size of the sectors, you end up seeing the mis-match you've identified.

Fundamentally, there are two fixes to this problem:

  • Use an external USB enclosure -- You can return the disk to the original enclosure and try to get it to work. Maybe it'll work on your Debian system even if it doesn't work under OS X. It's conceivable that the enclosure has failed at an inopportune time, though, in which case you might need to use another enclosure that translates sectors in exactly the same way as the first enclosure. I can't recommend a specific enclosure, since I haven't been following what specific models do, but this type of translation is pretty common. OTOH, some enclosures (especially older ones) do no translation, and so will not help.
  • Adjust the partition table -- It's possible to fix things by creating a fresh partition table with the appropriate values. In your case, you'd delete the one partition on the disk and create a new partition with sector values that are precisely 8 times the current values. In principle, you can do this with fdisk, but you'll almost certainly have to change the alignment policy. This used to be possible, but when I tried it just now with the fdisk in Ubuntu 16.04, I didn't see the option to change alignment. Your best bet might be to find an older version of fdisk, either by compiling it from source code in an archive or by using an old emergency or installation disk. Alternatively, you could delete the existing partition with fdisk and then rely on TestDisk or something similar to recover the partition using the current disk sector size. This is a bit hit-or-miss, but it will probably work.

The second option should work; however, if you make a mistake or run into some unexpected problem, you might end up making matters worse, especially if you write to the altered partition. Also, this option will lock you into using the disk either directly via SATA or via a USB enclosure that does not do sector-size translation. Overall, therefore, I recommend you focus on the first option. This may require buying a replacement enclosure.

answered on Super User Apr 17, 2017 by Rod Smith

User contributions licensed under CC BY-SA 3.0