I've been reading the man pages for GDISK (8) at http://www.rodsbooks.com/gdisk/gdisk.html
I'm a bit daunted. I especially don't see how to apply what you suggest, and I don't understand how I access the three different menus of gdisk that are detailed there. I'm going to leave work & go home, entailing a reboot, and see what is up here when I do that. Also I'll check diskutil list after booting.
sudo gdisk /dev/diskX
Replace X with the number for the whole disk that contains the Windows partition. Once you hit return, you will be in gdisk, in interactive mode. Use ? <enter> to display the main menu. You're after the recover/transformation menu, so that's r <enter>. Again use ? to display the options in this menu, you'll find the option to create a new hybrid MBR is h, and which point you'll be asked to input the information relevant to your disk. For those with 4 or fewer partitions, add all except partition 1. It's trickier when you have 5 or more partitions. Everyone should add EFI GPT to the first MBR entry (that's a y then enter). Once you're done that it asks for each partition you're adding what hex code to use, just enter the default, gdisk grabs the right code from the GPT; and asks whether it should be flagged bootable or not. Only the Windows partition should be flagged bootable.
When you're back at the prompt "Recovery/transformation command (? for help):" you can type p <enter> and o <enter> which will display the GPT and the new hybrid MBR. This is all in memory, it's not yet commited to disk so you can post those two things and just leave gdisk waiting in the background (hide Terminal if you want). When you're ready to write it out, w <enter> and then reboot after gdisk quits.
Thank you for drawing my attention to the apparent drive identity change. After reboot, my former disk0 is now disk1.
Since I do not want or need the Recovery HD partition anyway, I was considering
$ diskutil mergePartitions JHFS+ "MtnLion1" disk1s2 disk1s3
Then I would only have 4 partitions. Would you advise me to do that using diskutil, or to get rid of the offender in the process of using gdisk as you detail so clearly? If I understand you, when I am adding partitions to the about to be created new MBR hybrid, I would simply omit addition of the Recovery HD partition, which is now at
I backed up the drive to a network drive so I'm just now getting started. I followed the directions but didn't get the EE or 07 default HEX code that you stated in the first set of instructions on the first page of this thread. Instead I got this:
Not wantng to bork it even worse I decided to let it sit until confirmation from you that its ok to proceed.
Actually it's a good point that you can use diskutil mergepartitions to do this. Just make sure you have a backup.
The man page makes it clear that:
All data on merged partitions other than the first will be lost.
So make really sure that the first partition is the OS X partition you want to keep.
Data on the first partition will be lost as well if the force argument is given.
So don't use force.
However, realize that this merge will only grow the OS X partition into the Recovery HD partition. You have much, much more free space after the Recovery HD that this command will not recapture. For that you'll need to use diskutil resizevolume after you've mergedpartitions.
That 2nd partition is your OS X partition. The hex code is AF. So just accept the default. The next question about it will be whether to make it bootable, and the answer is no.
The following partition, #3, is your Recovery HD partition, the hex code is AB, you should accept that as default, and also do not make it bootable.
The last partition, #4, is Windows, accept the 07 default, do make this one bootable.
It's not strictly necessary to add OS X and Recovery HD partitions to the hybrid MBR. However I have some reason to believe that unsync'd hybrid MBRs and GPTs is causing some Apple utility to try to fix it, which can subsequently cause data loss. I haven't figured that part out at all because I have never seen a before MBR/GPT just prior to an OS upgrade that goes badly. So whenever possible I recommend people mimic Apple's version of a hybrid MBR, which is what I'm doing in this case.
That turns out to be a tricky business, making sure one has a backup.
Winclone 3.7 kicks an error citing partition 5 as the cause. I'm negotiating with the publisher.
It amazes me how full of surprises can be the experience of trying to recover from creating an extra partition on a Bootcamp drive, whether willfully, as did the OP (original poster) or inadvertently, as did I when I failed to scrutinize the activity of Carbon Copy Cloner adequately.
One method to backup that I find useful in cases like this, is a block copy. But you need a disk with at least as much free space on it, as the entire disk you're backing up. In your case, the disk to backup is 500GB, so you would need a 2nd drive with at least 500GB of free space. This backup method is inefficient because it includes free space and deleted files, literally every sector whether it's used or not, is backedup. But the advantage is, it's an exact snapshot, and easy to restore. Basically it's a sector copy, although the performance is faster if you specify a slightly larger block size (multiple sectors at a time). The command is dd.
You can use dd from/to a disk, partition, or file, in any combination. So you can turn a disk or partition into a file or vice versa. It's very much like Disk Utility pointed at a volume icon, and telling it to make a DMG of it. Except, this works with any file system. The catch is that the file system must be unmounted, because any mounted/active file system is constantly changing. So you can't make a sector backup of it while small bits are changing.
I can explain more how to do this if this is something you'd actually use, including how to find the mounted volume, unmount it, and how to copy the Windows partition to a file onto another drive. And briefly how to restore it should it be necessary.
But yeah, if the Winclone folks have a work around, that's easier because during their restore, they fix things automatically like the boot loader and BCD, which with a sector/block copy, you have to fix these things manually after a restore if they need fixing (by manually, you use Windows Startup Repair).
The source volume is now unmounted. It is now at dev/disk0s5. I have a place to put the output file (a JHFS+ volume with much more empty space than needed for the source).
I assume I want to tell dd what its source is – I can't figure that out from the man pages for dd. Perhaps you'll tell me how to navigate to the unmounted volume. Right now I have navigated to /dev and I can see the volume there.
I assume when I'm in the right place, I want to do something like
rightplace myuser$ dd of=path-to-output-file
Yes? Tell where/if I'm wrong, and how to navigate to the unmounted file so dd will accept it as the source, please.
Wow, do I appreciate your help!