lundi 9 février 2015

Fixing my external hard drive's partition map


Okay, so something really strange has happened, and it's a doozy, so please bear with me.




Problem: I need to fix my hard drive's partition map




So let me fill you in on what happened here.


I have an external 3TB hard drive that I use for storage with my Mac Pro. It recently had 4 partitions on it. This is what the map looked like.



  1. Backup [OS X, Journaled]: 1.4TB

  2. Macintosh HD clone [OS X, Journaled]: 0.3 TB

  3. Yosemite [OS X, Journaled]: 0.5 TB

  4. Windows Bridge [FAT]: 0.5 TB




I had originally downloaded and installed Yosemite on a separate partition to play around with it, and then when I decided I liked it, I copied my Mavericks Mac HD onto another partition of the drive as a backup. I then upgraded my main system to Yosemite.


Later on, I decided that I no longer needed the Mac HD clone, since Yosemite is pretty stable at this point, so I removed it; I also resized the Yosemite partition down to 300 GB since I wasn't going to write anything else to it.


The partition map then looked like this:



  1. Backup: 1.4TB

  2. Unallocated: 0.3TB

  3. Yosemite: 0.3TB

  4. Unallocated: 0.2TB

  5. Windows Bridge: 0.5TB




That was all fine. However, recently, I installed Windows through Bootcamp on my primary SSD. In Windows' disk management, I tried to remove the Windows Bridge partition and replace it with a 0.7TB NTFS partition. The partition deleted, but the reformat operation failed, so I figured I would boot into OS X, remove the partition, and add a new FAT 0.7 TB partition which could then be reformatted by Windows into NTFS.


I opened up Disk Utility and saw that the Windows Bridge partition was still there according to OS X. So I went ahead and removed it.




And then, bad stuff happened.


The windows partition removed successfully, but the Yosemite partition immediately became unrecognizable by OS X. The files are intact, but OS X sees it as disk1s3, and is unable to read, write, or repair the disk.


The strangest part of it all is that Windows can still read the drive. If I boot into Windows, I can copy anything from the partition, and it works just fine, but boot back into OS X, and the partition is unreadable.




Things I've tried


1. TestDisk and PDisk


I have tried to create my own partition map for the drive using TestDisk to find the partitions and PDisks to create the new partition. TestDisk shows some weird configurations. It appears as though there are two partitions, masquerading as MS Data, assigned to the same set of blocks, with the name Yosemite. That must be causing the problem:


enter image description here


PDisk will not let me open the disk to be rewritten.



pdisk: can't open file '/dev/rdisk1' for writing (Resource busy)



2. Copying all of the files and re-formatting.


Since Windows can read the disk, I figured, why not copy everything from the Yosemite partition onto the Windows ST partition and reformat the broken partition. The only problem with that is that Windows limits path names to 255 bytes, and in OS X, a lot of the files have filenames that are much longer than that. I need all of the files on the drive in order to keep it bootable, so skipping those files that would not copy is out of the question.




So:


Do any of you fine people have any ideas as to how I can fix this partition map and/or get all of my data off of that partition so I can reformat it?


I can definitely go pick up another 3 TB drive to use to copy all of the files off of the existing drive so that the drive can be completely reformatted if you know of a way that I can get all of the files off of the Yosemite partition.




Edit:



> diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 200.0 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
4: Microsoft Basic Data BOOTCAMP 50.1 GB disk0s4
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *3.0 TB disk1
1: EFI EFI 314.6 MB disk1s1
2: Apple_HFS Worth Backup 1.9 TB disk1s2
3: Microsoft Basic Data 300.0 GB disk1s3
4: Microsoft Basic Data WINDOWS ST 510.0 GB disk1s4





> diskutil cs list

No CoreStorage volume groups found





> sudo gpt -r -vvv show -l /dev/disk0

gpt show: /dev/disk0: mediasize=251000193024; sectorsize=512; blocks=490234752
gpt show: /dev/disk0: PMBR at sector 0
gpt show: /dev/disk0: Pri GPT at sector 1
gpt show: /dev/disk0: GPT partition: type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, start=40, size=409600
gpt show: /dev/disk0: GPT partition: type=48465300-0000-11AA-AA11-00306543ECAC, start=409640, size=390624992
gpt show: /dev/disk0: GPT partition: type=426F6F74-0000-11AA-AA11-00306543ECAC, start=391034632, size=1269536
gpt show: /dev/disk0: GPT partition: type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, start=392304640, size=97929216
gpt show: /dev/disk0: Sec GPT at sector 490234751
start size index contents
0 1 PMBR
1 1 Pri GPT header
2 32 Pri GPT table
34 6
40 409600 1 GPT part - "EFI System Partition"
409640 390624992 2 GPT part - "Customer"
391034632 1269536 3 GPT part - "Recovery HD"
392304168 472
392304640 97929216 4 GPT part - "BOOTCAMP"
490233856 863
490234719 32 Sec GPT table
490234751 1 Sec GPT header





> sudo gpt -r -vvv show -l /dev/disk1

gpt show: /dev/disk1: mediasize=3000592977920; sectorsize=4096; blocks=732566645
gpt show: /dev/disk1: Suspicious MBR at sector 0
gpt show: /dev/disk1: MBR part: type=175, start=76806, size=461468854
gpt show: /dev/disk1: MBR part: type=7, start=534820616, size=73242187
gpt show: /dev/disk1: MBR part: type=12, start=608062976, size=124503552
gpt show: /dev/disk1: Pri GPT at sector 1
gpt show: /dev/disk1: GPT partition: type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, start=6, size=76800
gpt show: /dev/disk1: GPT partition: type=48465300-0000-11AA-AA11-00306543ECAC, start=76806, size=461468854
gpt show: /dev/disk1: GPT partition: type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, start=534820616, size=73242187
gpt show: /dev/disk1: GPT partition: type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, start=608062976, size=124503552
gpt show: /dev/disk1: Sec GPT at sector 732566644
start size index contents
0 1 MBR
1 1 Pri GPT header
2 4 Pri GPT table
6 76800 1 GPT part - "EFI System Partition"
76806 461468854 2 GPT part - "Worth Backup"
461545660 73274956
534820616 73242187 3 GPT part - "Yosemite"
608062803 173
608062976 124503552 4 GPT part - "WINDOWS ST"
732566528 112
732566640 4 Sec GPT table
732566644 1 Sec GPT header





> sudo fdisk /dev/disk0

Disk: /dev/disk0 geometry: 30515/255/63 [490234752 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: EE 1023 254 63 - 1023 254 63 [ 1 - 490234751] <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





> sudo fdisk /dev/disk1

Disk: /dev/disk1 geometry: 45600/255/63 [732566645 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 - 76805] <Unknown ID>
2: AF 1023 254 63 - 1023 254 63 [ 76806 - 461468854] HFS+
3: 07 1023 254 63 - 1023 254 63 [ 534820616 - 73242187] HPFS/QNX/AUX
4: 0C 1023 254 63 - 1023 254 63 [ 608062976 - 124503552] Win95 FAT32L




Aucun commentaire:

Enregistrer un commentaire