1

I really have a problem with my HDD. I was working on it, it was my local HDD installed on a MacBook 2009 but some day my Mac turned off suddenly and it didn't work again.

I installed OS X on a new disk and tried to attach the other in an external case but the volume doesn't mount.

The now broken disk contained one visible volume and OS X 10.10 Yosemite was installed.

Here are the partition infos I can see:

arturoperez$ diskutil list

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS New Mac                 99.5 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:                  Apple_HFS Datos                   149.6 GB   disk0s4
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *159.3 GB   disk1
   1:                       0xEE                         159.3 GB   disk1s1

arturoperez$ diskutil info /dev/disk1s1

   Device Identifier:        disk1s1
   Device Node:              /dev/disk1s1
   Part of Whole:            disk1
   Device / Media Name:      Untitled 1

   Volume Name:              Not applicable (no file system)

   Mounted:                  Not applicable (no file system)

   File System:              None

   Partition Type:           0xEE
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 USB
   SMART Status:             Not Supported

   Total Size:               159.3 GB (159307878400 Bytes) (exactly 311148200 512-Byte-Units)
   Volume Free Space:        Not applicable (no file system)
   Device Block Size:        4096 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no file system)
   Ejectable:                Yes

   Whole:                    No
   Internal:                 No

The output of sudo gpt -r show /dev/disk1 and sudo fdisk /dev/disk1:

arturoperez$ sudo gpt -r show /dev/disk1

     start      size  index  contents
         0         1         PMBR
         1  38893525         


arturoperez$ sudo fdisk /dev/disk1

Disk: /dev/disk1    geometry: 2421/255/63 [38893526 sectors]
Sector size: 4096 bytes
Signature: 0xAA55
         Starting       Ending
#: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
1: EE 1023 254  63 - 1023 254  63 [         1 -  312581807] <Unknown ID>
2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

Apparently it doesn´t have an active partition but I tried by different ways to fix it and i couldn´t.

Is there anyone who can help me with this? I have important information there and I need to restore it asap.

Update 1

After trying to follow the instructions in klanomath's answer, I get this message when I try to create a new GPT.

arturoperez$ diskutil unmountDisk disk1
Unmount of all volumes on disk1 was successful
arturoperez$ sudo gpt -r show /dev/disk1
     start      size  index  contents
         0         1         PMBR
         1  38893525         
arturoperez$ sudo gpt create disk1
arturoperez$ sudo gpt add -b 40 -i 1 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk1
gpt add: disk1: error: no primary GPT header; run create or recover

Update 2

I tried to make an image with TestDisk, it took 3 days to finish... I changed the disk geometry and then I analyzed it again. This is the result:

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

Disk /dev/disk1 - 160 GB / 149 GiB - CHS 19457 255 63

     Partition                  Start        End    Size in sectors
  1 P EFI System                    40     409639     409600 [EFI System Partiti
> 2 P Mac HFS                   409640  311312231  310902592 [Sin t ulo]
  3 P Mac Boot               311312232  312581767    1269536 [Recovery HD]

Now i'm stuck because i don't know what is the next step.

5
  • It´s Yosemit 10.10 and there were just one volume... i just had one partition... when i executed testdisk there were no information about the heads and sectors of the disk... i don't know why this could be happen.
    – ArtMac
    Apr 28, 2015 at 0:11
  • MacBookdeArturo:Recuperacion HDD arturoperez$ sudo gpt -r show /dev/disk1 Password: start size index contents 0 1 PMBR 1 38893525
    – ArtMac
    Apr 28, 2015 at 18:13
  • Ready, i added the info you requested... it's important to comment this: yesterday i changed the disk geometry and i could find some partitions, in this moment i am executing a process with testdisk to make a disk image.
    – ArtMac
    Apr 28, 2015 at 18:19
  • @klanomath: I have stared at this long enough without being able to figure it out. So, I will just ask: Is it normal for the sector size to be 4096 bytes? I have only seen such a sector size once before and that drive was 3 TB in size. Could the external case be designed for an Advanced Format Disk? Apr 29, 2015 at 15:42
  • @DavidAnderson Yes, meanwhile it's a normal physical sector size. It's the so-called AF (Advanced Format). Gpt, fdisk etc. still adhere to 512 byte sectors on the surface - probably for compatibility reasons (MBR/GPT) and/or the "human habit". But internally they usually consider the 8 sector alignment (8 old sectors = 1 new sector). Check the gpt listings below or your own. The 3 major partitions are all aligned to 4096 byte sectors (all start blocks and sizes are dividable through 8!)
    – klanomath
    Apr 29, 2015 at 16:14

3 Answers 3

1

A good option is to try DiskWarrior:

Everything just disappeared after your Mac went haywire. All your work documents. The music you most enjoy. The movie of your kid's first steps. It's your life and it's gone. Don't panic! DiskWarrior will recover your documents, photos, music and any other files when disaster strikes and you lose access to your files.

It may not be suitable depending on your original disk format but TestDisk can also recover damaged partitions:

TestDisk is powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software: certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy.

4
  • Thanks for response... i was trying with testdisk but maybe i'm not an expert using it... is there anyway to help me with the commands or a guide?
    – ArtMac
    Apr 27, 2015 at 18:20
  • I have no experience with TestDisk, but I have successfully used DiskWarrior. Hopefully someone will be along shortly to help provide a tutorial or guide. Apr 27, 2015 at 18:23
  • 1
    I have no experience with TestDisk, but it seems to be based on pattern detection, so you will be able to recover (some) files to another media, but not to restore your disk. On the other hand, Disk Warrior performs an in memory reconstruction of the directory tree of HFS discs, so you can recover any part of your disc copying to a different one.
    – juandesant
    Apr 27, 2015 at 20:44
  • I'm having the issue this question addresses after a mac crash. I've just bought and tried Disk Warrior and it doesn't even see the disk I'm trying to repair :(
    – occulus
    Jul 15, 2016 at 15:22
1

Usually Mac disks contain a GPT (GUID Partition Table) to define the partitions. Your GPT seems to be destroyed/lost and only the PMBR is left. Your main goal is to rebuild the GPT. Recreating your GPT doesn't affect the content of your disk - except the first and last 32 blocks of course.

To reproduce your problem I've created a disk in a Yosemite-VM with the size mentioned in your question: 311,148,200 blocks à 512 Bytes=159,307,878,400 Bytes and installed a vanilla Yosemite system (10.10.3) including a Recovery HD.

After installing Yosemite your standard partition layout for disk1 should look like this:

user$ sudo gpt -r show /dev/disk1
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  309468984      2  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  309878624    1269536      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  311148160          7         
  311148167         32         Sec GPT table
  311148199          1         Sec GPT header

If you don't want to buy DiskWarrior or aren't successful restoring the disk with TestDisk, you may try the following approach:

Backup disk1 to a raw file on a volume with enough free space with dd in case the following solution fails.
Example: dd if=/dev/rdisk1 of=/Volumes/Backup/disk1.raw bs=1m. You need at least ~165 GB (the more, the better) of free space on the backup volume.

Now you may try to restore the GUID partition table with gpt.

Open Terminal and enter:

diskutil unmountDisk disk1

to unmount disk (assuming disk1 is your broken disk)

then enter

sudo gpt -r show /dev/disk1

(enter your password if you are asked for it) to get the current layout. It should look like this:

 start      size  index  contents
     0         1         PMBR
     1  38893525         

now enter:

sudo gpt create disk1

to create a new (empty) GPT
then enter

sudo gpt add -b 40 -i 1 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk1

to create a partition table entry for the EFI-partition

unmount disk1 again if a new volume pops up on your desktop (unlikely):

diskutil unmountDisk disk1

then

sudo gpt add -b 409640 -i 2 -s 309468984 -t 48465300-0000-11AA-AA11-00306543ECAC disk1

to create a partition table entry for the main JHFS+-volume

unmount disk1 again if a new volume pops up on your desktop (happens often):

diskutil unmountDisk disk1

then

sudo gpt add -b 309878624 -i 3 -s 1269536 -t 426F6F74-0000-11AA-AA11-00306543ECAC disk1

to create a partition table entry for the Recovery HD.

Then you may label all the partitions with sudo gpt label -i IndexNumber -l "Name" diskNumber:

sudo gpt label -i 1 -l "EFI" disk1
sudo gpt label -i 2 -l "OldMacintoshHD" disk1
sudo gpt label -i 3 -l "Recovery HD" disk1

Now remount disk1 with:

diskutil mountDisk disk1

Quit Terminal by entering exit and open Disk Utility. If the attempt was successful you should now see your previously vanished main volume. Check the volume for errors and repair them if necessary. Repairing them may be desastrous (depends on the errors) without backup. Please leave a comment with the error message(s) before repairing.

This solution should work if you had a standard partition layout with one visible main volume previously and never had a second partition or installed Windows with the Boot Camp Assistant on the disk.

If you are in doubt I've already answered a similar question with a similar approach. The linked answer may work if you had a non-standard layout. You need to search for special strings/patterns with wxHexEditor on your disk to detect the start block/end block of your main volume and the Recovery HD and then calculate the table entries.

3
  • Thanks for response... i will follow your recommendation and will let you know.
    – ArtMac
    Apr 28, 2015 at 22:32
  • @ArtMac I'm investigating both (gpt/TestDisk) at the moment. Please delete your last 3 comments here because they are hard to read without proper formatting. I already incorporated your "answers"/replies in your questions (check update 1 & 2 at your question).
    – klanomath
    Apr 30, 2015 at 12:42
  • @ArtMac I can't reproduce the error message "gpt add: disk1: error: no primary GPT header..." after executing sudo gpt create disk1. I complete erased the mbr and the gpt on my test disk with gdisk and still have been able to restore everything! Please check your log files with the Console.app if you get an error (e.g. i/o errors) executing sudo gpt create disk1 and add it to your question.
    – klanomath
    Apr 30, 2015 at 15:42
0

I have a similar issue, I Have a MBP 10,2 with Mac OS X Sierra 10.12 installed. I was running Windows 8.1 with VMWare Fusion, and i had the virtual disk on my external own, when the computer turned down cause no more battery, my external HD got stuck. I can see it from Disk Utility but the partition is unmounted. When i try to repair it says me that the filesystem output is (8) and there's an error. I try to mount it but nothing appears, just the HD led blinking for a while, like he's trying to connect but he can't do it. I tryed to mount it also from diskutil in terminal, but nothing happens. I've also tried to verify and repair it but nothing again.

Here's the output of: diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintos HD             120.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            Macintosh HD           +120.1 GB   disk1
                                 Logical Volume on disk0s2
                                 15FE7657-5A3E-43B3-95A6-D577A121CF75
                                 Unencrypted

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *320.1 GB   disk2
   1:                  Apple_HFS BACKTRAXX               320.1 GB   disk2s1

/dev/disk3 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        +536.9 MB   disk3
   1:        Apple_partition_map                         32.3 KB    disk3s1
   2:                  Apple_HFS StellarVolumeOptimizer  536.9 MB   disk3s2

Here's the output of: sudo gpt -r show /dev/disk2

start       size  index  contents
          0          1         MBR
          1       2047         
       2048  625137664      1  MBR part 175
  625139712       2736

And here's the sudo fdisk /dev/disk2 one:

sh-3.2#
Disk: /dev/disk2    geometry: 38913/255/63 [625142448 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
*1: AF 1023 254  63 - 1023 254  63 [      2048 -  625137664] HFS+        
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused      

I'll hope that someone knows what to do, cause I've already tried everything that everyone said me, and I don't want to lose the files inside the HD..

Best regards.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .