2015年12月15日 星期二

How to Fix the Broken Bootcamp Partition after Resizing Mac OS X Partition

http://nerdr.com/bootcamp-partition-lost-repairing-mac-partitions/

How to Fix the Broken Bootcamp Partition after Resizing Mac OS X Partition

First, we need to download some software to handle the partition fixing.  Get gptfdisk from here:
Download the latest version (I used 0.8.6) and because you’re on a Mac you will need the .pkg version.
Once you have downloaded gptfdisk double click the file and install the .pkg file that downloaded.  That’s all the software we’ll be using.  Now it’s just you and terminal.
NOTICE – Now is a good time to plug your Macbook in to charge, you don’t want the power going out while changing the MBR.  Trust me.  Also a great time to BACKUP everything on your Mac and Windows Bootcamp partition.  I just backed up my Mac side because I like to live dangerously and my Windows Bootcamp partition is just for games and testing.
Now back to fixing.
Open terminal.  For a quick shortcut to open it press (CMD + spacebar) to open the spotlight quick search and type terminal.  That will open terminal.  It has >_ as it’s icon.
Let’s see what the state of your MBR is first.  Type these three things.  After each one press enter.  You will need your password for them because we use sudo.  None of the lines change anything on your computer and are used so you can get information about the state of your MBR and partitions.  Type carefully, and that is a vee vee not double you on line 1, and it is disk-numberzero not disk-oh.
  1. sudo gpt -r -vv show disk0
  2. sudo fdisk /dev/disk0
  3. diskutil list
One shows you disk status and partitions.  Two shows you types and three shows you your hard disk partition setup.  Three is the most important.
Output of line 3:
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *250.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS SSD 125.0 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s5
4: Microsoft Basic Data exfat1 24.2 GB disk0s6
5: Microsoft Basic Data BOOTCAMP 100.0 GB disk0s4
IMPORTANT! note down the number on the left of BOOTCAMP when you do line three above!  For me this number was 5.  For you it might be 4.  This is what we will use to tell the MBR it’s a boot drive.
That’s the setup and preparation complete.  Now it’s time to go deep.  Open a new terminal window.  Anywhere that says <enter> means press enter.
Type the following line to start disk:
sudo gdisk /dev/disk0
r <enter>        go to the recovery & transformation menu
h <enter>        create a new hybrid MBR.
STOP! the next line is the most important.  Use whatever your bootcamp partition was above when we did line 3.  My Bootcamp partition on my Mac was 5.  Yours may be 4 or even 3.
5 <enter>        add partion 5 to the MBR.  Your’s may be different! Use what you got from line 3 above.
y <enter> if you are asked “Place EFI GPT (0xEE) partition first in MBR (good for GRUB)?”
<enter>          accept the default MBR hex code of 07
y <enter>        set the bootable flag
n <enter>        do not protect more partitions
o < enter>       print (display) the MBR.
You will see a message telling you it’s go time to actually write the partition.  It will say “Disk size is …” and list two MBR partitions it will make.   This is essentially a notification of what the new MBR will look like.  Look at it and if it looks acceptable then hit w <enter> to write out the table:
w <enter>     Recovery/transformation command (write partition table to disk)
y <enter>  Say yes to question: do you want to proceed.
It will recommend you reboot your Macbook.  Do it and when it’s booting up hold the left ALT/option key like you always do to boot up into Bootcamp.  It should work.
If it did work, great!  Don’t do it again :)  If it didn’t work…try the link at the top to the Apple forum post.  It’s 45 pages long right now so good luck with that but the guy seems very helpful.
Final disclaimer.  This post is for my personal use only and I accept no responsibility for anything you do with it or if anything bad or good happens because you followed the instructions above.  This fix worked for me once and will hopefully work next time I accidentally destroy my Bootcamp partition and stop Windows bootcamp from booting or showing in the startup choice menu when starting my Mac.




沒有留言:

張貼留言