Bash shell is the up arrow/down arrow, but GPT is different. It needs to supprt backing up a menu. You can try escape key.
I wanted to come here and salute Christopher Murphy for being accommodating, with a willingness to help which seems to be unmatched in all these discussions.
PS: Apple should write you [Christopher] some cheques for moolah.
Control-C to cancel works for most any CLI program. However, gdisk works non-destructively, its changes are only in memory until you use w to write changes. You can q to quit without changes. And backing up doesn't really make sense in gdisk, you can see what area of the menu you're in with its command line, list the menu with ? and just start over with a new hybrid mbr if you've messed things up.
As for Apple I don't think these problems are a high priority, it's easier for them to blame this on Windows. In reality their tools should NOT replace the MBR just because it's out of sync with the GPT, no good comes from this and that's why this particular problem happens. A similar problem happens if you ever try to add another partition to a Bootcamped drive so don't ever try it! It will nuke that hybrid MBR without warning and then you won't be able to boot Windows again.
And Rod Smith, creator of gdisk, deserves a thank you also. The notes on hybrid MBRs on his web site is kinda eyebrow raising. I really wish Apple did more to prevent users from modifying their drives once they've been bootcamped. Disk Utility should refuse to change the layout, even according to their own technote on this subject.
Those last two sentences are saying a Bootcamped disk has just such a block 0, it's not GPT compliant (which is why the original gpt command I gave returns a message "suspicious MBR" and that manipulating it) and nothing should manipulate it. Best case scenario is only to allow the user to completely delete everything on the disk, or nothing, once Bootcamped.
Kinda frustrating this has been going on for many years now.
So the problem with a formal guide is that you're assuming there's only one kind of problem with one kind of solution. There are about 7 or 8 differently caused problems, with different solutions, that all result in Windows not booting. So unless you're prepared to document every single one of them, what invariably happens is someone who can't boot Windows starts using your guide, not knowing it doesn't apply to their situation, and they end up causing worse problems and actual real data loss.
And that's why I haven't written one.
For the proposed guide to apply all of these things must be true:
1. The user resized their original OS X partition using Disk Utility or diskutil, to create free space. (If they created another partition in its place, they have a different problem and a different solution).
2. The user rebooted into Windows and used a Windows utility *that doesn't understand Apple's hybrid MBR scheme* to grow the NTFS volume into the free space previously created in step 1. It's difficult to know if the utlity you're using understands hybrid MBRs or not, if you don't know what one is yourself.
3. The user subsequently upgraded to OS X 10.7, 10.8 or 10.9 and found they could no longer boot Windows. Or they ran diskutil repairdisk, or ran Disk Utility repair after having clicked on a whole disk device (node) rather than an OS X volume. Fundamentally this is the event that causes the MBR with correct information to be wiped out.
4. Their hard drive contains ONLY and precisely, in this order, four partitions: EFI System, OS X, Recovery HD, Windows. If it's any other order, then your instructions won't apply, they'd have to be different to account for this difference.
5. The results from fdisk, partition 4, ID is hex code 0C.
6. The results from the gpt command, indicates a lot of free space between partitions 3 and 4.
Anyway, this is pretty specific, so as long as you're willing to qualify that you're only talking about one very specific kind of Windows not booting problem, and describe it in a way that some people won't try to follow it and make their situation worse, have at it.
Add one more to the scoreboard! I got my system up and running as well. Your mileage may vary if you have more partitions.
Here's a quick overview of the steps I used. I can not emphasize enough to read this thread from page 48 on and to either take screenshots or copy notes of the before and after values just in case.
- Downloaded TestDisk and gdisk
- Used TestDisk to locate the partition by trying to list the files for the partition. If it lists the files of your root drive then that should be the right one. Copy the starting and ending values
- Located the bad partition by noting that we couldn't list the files for that partition
- Used gdisk to delete the invalid partition and create a new one using the correct starting and ending values. Not sure if it was necessary but also renamed the partition to BOOTCAMP
- Rebooted and saw the drive now mounted in OSx
- Used gdisk to create the hybrid MBR using tomd007's instructions here https://discussions.apple.com/message/23507319#23507319 Do note to make sure you use the 'w' command to write the mbr out to disk
- rebooted with option key
- able to select the windows boot drive
BIG BIG Thanks to Christopher Murphy, tomd007, and frankywashere for the help!
It's quite excited while finding your comments here, since I just updated mavericks and have the same problem....means I must find a way to make the windows partition back.
WIll follow all the steps you mentioned here with one question:
Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 3 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y
From above input, 2 3 4, what does these numbers mean? and I have two partitions and one of them is windows bootcamp, should I just input the same number as you did?
There's no possible way to answer your question from the available information. Please set the gdisk window aside, and make a new Terminal window (or tab) and type the following commands and copy-paste the output, ideally change the font to andale mono 8pt using the forum's advanced editor so it formats properly.
sudo fdisk /dev/rdisk0
sudo gpt -r -v show /dev/rdisk0
Any way you can help me reclaim my lost partition?
Macintosh:~ Heather$ sudo fdisk /dev/rdisk0
Disk: /dev/rdisk0 geometry: 91201/255/63 [1465149168 sectors]
#: id cyl hd sec - cyl hd sec [ start - size]
1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
2: AF 1023 254 63 - 1023 254 63 [ 409640 - 1171875000] HFS+
3: AB 1023 254 63 - 1023 254 63 [1172284640 - 1269536] Darwin Boot
4: 0C 1023 254 63 - 1023 254 63 [1318086656 - 147060736] Win95 FAT32L
gpt show: /dev/rdisk0: mediasize=750156374016; sectorsize=512; blocks=1465149168
gpt show: /dev/rdisk0: Suspicious MBR at sector 0
start size index contents
0 1 MBR
1 1 Pri GPT header
2 32 Pri GPT table
40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
409640 1171875000 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
1172284640 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
1318086656 147060736 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
1465149135 32 Sec GPT table
1465149167 1 Sec GPT header
Wonderful, I was scared to try any of that in case my bork was a result of something different. I already downloaded gdisk and testdisk, but I feel like the first few steps of testdisk are missing. I will go back and re-read while I am waiting for my backup to finish and see if that clears up my questions.
Yeah the gist of it is that you're going to iterate in testdisk to find your data. It may have more than one proposed NTFS volume. You'll choose one and chances are it's wrong and will say the file system is damaged, and won't show you anything. When you find the right one, you'll be able to list files and folders. Once you have that, you need to make a note of the start and end sector values, which testdisk shows you. You can actually just leave it open in a window if you want.
Then move to gdisk. At any time you can type ? to get the current menu of options. And p will show you the current partition map. You want to delete the bogus partition 4, and then add a new partition which will default to number 4. Plug in the start and end sector values you have from testdisk. Use 0700 for the partition type code. And then w to write out the changes to disk, and reboot.
That part should get you a BOOTCAMP volume mounted in the Finder as read-only. If so, 90% of the work is done and at least you have access to your files. To make Windows bootable you need the additional steps in gdisk to create a new hybrid mbr where you will add partitions 2 3 4 to the hybrid MBR, accept their default hex/type codes, and only make 4 bootable. And then once you're back to the recovery prompt, use w to write out the new partition maps again and reboot.