Tuesday, October 28, 2014

macos - How can I use Boot Camp again now that there is a recovery partition between my Mac and Windows partitions?


It's been a very long time since I booted natively into Boot Camp (I've been using virtual machines for a while), but I'd like to do it again to play Windows-exclusive games. When I tried, though, I got a message about the partition not being bootable.


So, I thought I would just reinstall Windows, since I now have Windows 8 and there's nothing important on my Windows 7 partition. So I fired up the Boot Camp assistant and told it to merge my Windows partition into my Mac OS partition again, and it failed. It told me, descriptively, that "[my] disk cannot be restored to a single partition". The Windows partition is gone, but my Mac OS partition is not bigger than it was before.


I tried again from the Disk Utility, and I got a message that told me, instead, that this is because of a filesystem error.


So I went and looked at a lower-level what's going on and found out that either Lion or Mountain Lion took a 650 MB chunk at the end of my Mac OS partition to put the recovery partition, which is now sandwiched between the Mac OS partition and the (now defunct) Windows partition:


$ sudo gpt -r show disk0
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 720414896 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC
720824536 1269544 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
722094080 254679055
976773135 32 Sec GPT table
976773167 1 Sec GPT header

Partition index 1 is the 200 MB EFI partition; index 2 is my Mac OS partition; index 3 is the recovery partition; and that free block is the place where my Windows partition was before the Boot Camp assistant thrashed it away.


Obviously, with a new partition in the way, the system can't reintegrate the free space into my Mac OS volume.


I don't really care about the partition layout since I planned giving Windows 8 the exact same size. However, I'm concerned that I won't be able to install Windows again with this current setup.


How can I install Windows 8 on my Mac, without breaking my Mac OS install, under these circumstances?


Here are some things I have been thinking about:



  1. Use gpt to create a partition in the free space, then newfs to create something Windows can install on, but this does not modify the MBR in a Boot Camp-compatible way;

  2. Move the recovery partition to the far end of the disk (right before the secondary GPT table) and then use Disk Utility to merge the contiguous free space into my Mac OS partition, and then use the Boot Camp assistant normally, but I have no idea how to move partitions;

  3. Back up everything, bulldoze everything on the disk, freshly reinstall Mac OS, freshly install Windows, restore backups on Mac OS, but that's gonna take forever, and I can't do it until I get a big enough drive (I'm temporarily not doing any back ups, unfortunately).


Any guidance?


Answer



There are two basic approaches to installing Windows on your system with minimal disruption. Both begin with creating GPT partition(s) for Windows in that big block of free space. You can then do one of two things:



  • Create a fresh hybrid MBR on the disk that refers to the Windows partitions alone. Although most of the "traditional" tools for doing this, like gptsync, won't work in your situation, some will. My own GPT fdisk (gdisk) is one that can do the job. You can then boot the Windows installer in BIOS mode and install in that way. You should then be able to boot using the Option key to enter Apple's boot manager or use a third-party boot manager like rEFIt or rEFInd.

  • Wipe any hybrid MBR data that might exist on the disk and restore a traditional legal protective MBR. You can then boot the Windows 8 installer in EFI mode and install it that way. You may also want rEFIt or rEFInd as a boot manager. This approach is theoretically cleaner, but AFAIK Apple doesn't support it, and it may not work well on all computers. This lengthy forum thread describes efforts to do this, initially with Windows 7 but later with Windows 8. There are probably other forum posts that describe how to do it, but I don't have references offhand.


I strongly recommend you read that first link I provided on hybrid MBRs; they're an ugly hack that break down easily, and your configuration requires doing things with them that could easily lead you into trouble. If you understand them, you're less likely to have problems with a hybrid MBR -- whether it's to create a new one or verify that all traces of your old one are gone.


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...