Monday, June 8, 2015

macos - Mounting OSX hard-drive on linux



I believe the motherboard on my macbook died, so I'm trying to recover the information on the disk. I pulled the hard drive from the macbook and plugged it into one of my SATA ports on my Ubuntu machine. Unfortunately, I can't seem to mount it:




mgilson@iris:~$ sudo fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sda1 1 38914 312571223+ ee GPT

Disk /dev/sdc: 251.0 GB, 251000193024 bytes
255 heads, 63 sectors/track, 30515 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0005ee8d

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 29274 235141120 83 Linux
/dev/sdc2 29274 30516 9973761 5 Extended
/dev/sdc5 29274 30516 9973760 82 Linux swap / Solaris

Disk /dev/sdd: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0008695d

Device Boot Start End Blocks Id System
/dev/sdd1 1 243201 1953512001 83 Linux

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000efe53

Device Boot Start End Blocks Id System
/dev/sdb1 1 243202 1953514583+ 8e Linux LVM


It's the 320Gb disk, so it should be on /dev/sda1 if I understand this stuff correctly. Unfortunately, when I try to mount it:




sudo mkdir /media/Mac
sudo mount -t hfsplus /dev/sda1 /media/Mac


I get the following error:



mount: wrong fs type, bad option, bad superblock on /dev/sda1,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so



Looking at the output of tail, I get:



[ 1325.009342] hfs: unable to find HFS+ superblock


So, perhaps this isn't an HFS+ partition. Is there any way to detect what kind of partition it is?


Answer



fdisk is for hard drives that are still using the old legacy Master Boot Record (MBR) partition table format.
GParted is for hard drives that are using the modern GUID Partition Table (GPT).




Hard drives that use GPT often have a "Protective MBR" (PMBR); a fake MBR to try to keep old school MBR-centric formatting/partitioning software from thinking the hard drive is unformatted. The PMBR basically lies and claims that the whole hard drive is allocated as one huge partition.



Macs with Intel processors (read: since 2006) have required or at least strongly preferred GPT for internal/bootable hard drives.



The copy of fdisk you ran was at least smart enough to detect that it was looking at a PMBR on a GPT drive, and print a big warning on the first line of output that you needed to use GPT instead.



Using an MBR-only utility like fdisk to try to figure out the partition table of a GPT drive is an exercise in futility, since the PMBR doesn't even try to stay in sync with the authoritative info in the GPT.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...