Boot Camp does not boot after disk cloning

bootcampfusion-drivepartition

I've got a MacBook5,1, and I replaced the CD drive with a SSD. Then, I made a "DIY fusion drive". Before doing it, I was using the regular setup, with Boot Camp. Then I put the SSD and made the Fusion drive, and restore a Time Machine backup, so I didn't modify the wWindows partition. I was using that for more than a year.

Last week my "regular" HD started to fail (remember, it has a small partition for Windows and a big one as Macintosh HD), so I bought a new one with the same size of 1 TB.

I put both disks on sata connectors inside a desktop computer and i cloned it with acronis true image. Against all odds and after 5 hours, i put the new drive inside the macbook, and after 15 minutes filling the bar (I guess it was repairing something caused by the malfunctioning old HD), it finally booted. And it works perfectly, now I'm using it.

But today I realised that I can not boot on Windows. The partition is still there, but I can not boot when pressing option key on the startup. I can remember something about a maximum of 4 partitions in the disk due to MBR limits (or is it GPT? actually I never remember which are one or the other…), that's the reason why I think I haven't got a recovery partition. But now the disk have 5 partitions, and one of them which is new to me: the "Microsoft reserved".

Is there any way to recover it without losing Windows data? I was reading a post about something similar in this forum, but that guy hadn't got the DIY FD, and anyway I could't install gptfdisk because of a popt.h missing error…

Maybe this is useful:

diskutil list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *128.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage                         127.7 GB   disk0s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk1
   1:         Microsoft Reserved                         134.2 MB   disk1s1
   2:                        EFI EFI                     209.7 MB   disk1s2
   3:          Apple_CoreStorage                         897.0 GB   disk1s3
   4:                 Apple_Boot Recovery HD             650.1 MB   disk1s4
   5:       Microsoft Basic Data Windows HD              102.0 GB   disk1s5
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh FD           *1.0 TB     disk2
                                 Logical Volume on disk0s2, disk1s3
                                 CF615BFD-DE74-4DB6-9048-DDD0C370D6DB
                                 Unencrypted Fusion Drive

Answer @davidanderson:
I did the copy using Acronis for Windows.

sh-3.2# mount
/dev/disk2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk1s5 on /Volumes/Windows HD (fusefs_txantfs, local, synchronous)
localhost:/zzw3xSzLWDmPOMfw7vG9UG on /Volumes/MobileBackups (mtmfs, nosuid, read-only, nobrowse)
sh-3.2# sudo  gpt  -r  show  /dev/disk1
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34      262144      1  GPT part - E3C9E316-0B5C-4DB8-817D-F92DF00215AE
      262178        2014         
      264192      409600      2  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      673792  1751953408      3  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  1752627200     1269760      4  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1753896960      409600         
  1754306560   199217152      5  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1953523712        1423         
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header
sh-3.2# sudo  fdisk  /dev/disk1
Disk: /dev/disk1    geometry: 121601/255/63 [1953525168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 - 1953525167] <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      
sh-3.2# sudo  dd  if=/dev/disk1  count=1  |  xxd
1+0 records in
1+0 records out
512 bytes transferred in 0.000182 secs (2814526 bytes/sec)
0000000: 33c0 8ed0 bc00 7c8e c08e d8be 007c bf00  3.....|......|..
0000010: 06b9 0002 fcf3 a450 681c 06cb fbb9 0400  .......Ph.......
0000020: bdbe 0780 7e00 007c 0b0f 850e 0183 c510  ....~..|........
0000030: e2f1 cd18 8856 0055 c646 1105 c646 1000  .....V.U.F...F..
0000040: b441 bbaa 55cd 135d 720f 81fb 55aa 7509  .A..U..]r...U.u.
0000050: f7c1 0100 7403 fe46 1066 6080 7e10 0074  ....t..F.f`.~..t
0000060: 2666 6800 0000 0066 ff76 0868 0000 6800  &fh....f.v.h..h.
0000070: 7c68 0100 6810 00b4 428a 5600 8bf4 cd13  |h..h...B.V.....
0000080: 9f83 c410 9eeb 14b8 0102 bb00 7c8a 5600  ............|.V.
0000090: 8a76 018a 4e02 8a6e 03cd 1366 6173 1cfe  .v..N..n...fas..
00000a0: 4e11 750c 807e 0080 0f84 8a00 b280 eb84  N.u..~..........
00000b0: 5532 e48a 5600 cd13 5deb 9e81 3efe 7d55  U2..V...]...>.}U
00000c0: aa75 6eff 7600 e88d 0075 17fa b0d1 e664  .un.v....u.....d
00000d0: e883 00b0 dfe6 60e8 7c00 b0ff e664 e875  ......`.|....d.u
00000e0: 00fb b800 bbcd 1a66 23c0 753b 6681 fb54  .......f#.u;f..T
00000f0: 4350 4175 3281 f902 0172 2c66 6807 bb00  CPAu2....r,fh...
0000100: 0066 6800 0200 0066 6808 0000 0066 5366  .fh....fh....fSf
0000110: 5366 5566 6800 0000 0066 6800 7c00 0066  SfUfh....fh.|..f
0000120: 6168 0000 07cd 1a5a 32f6 ea00 7c00 00cd  ah.....Z2...|...
0000130: 18a0 b707 eb08 a0b6 07eb 03a0 b507 32e4  ..............2.
0000140: 0500 078b f0ac 3c00 7409 bb07 00b4 0ecd  ......<.t.......
0000150: 10eb f2f4 ebfd 2bc9 e464 eb00 2402 e0f8  ......+..d..$...
0000160: 2402 c349 6e76 616c 6964 2070 6172 7469  $..Invalid parti
0000170: 7469 6f6e 2074 6162 6c65 0045 7272 6f72  tion table.Error
0000180: 206c 6f61 6469 6e67 206f 7065 7261 7469   loading operati
0000190: 6e67 2073 7973 7465 6d00 4d69 7373 696e  ng system.Missin
00001a0: 6720 6f70 6572 6174 696e 6720 7379 7374  g operating syst
00001b0: 656d 0000 0063 7b9a 4803 555d 0000 0000  em...c{.H.U]....
00001c0: 0200 eefe ffff 0100 0000 af6d 7074 0000  ...........mpt..
00001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa  ..............U.
sh-3.2# sudo  gpt  -r  show /dev/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  249397856      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  249807496     262144      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  250069640          7         
  250069647         32         Sec GPT table
  250069679          1         Sec GPT header
sh-3.2# sudo  fdisk  /dev/disk0
Disk: /dev/disk0    geometry: 15566/255/63 [250069680 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -  250069679] <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      
sh-3.2# sudo  dd  if=/dev/disk0  count=1  |  xxd
1+0 records in
1+0 records out
0000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
512 bytes transferred in 0.000313 secs (1635555 bytes/sec)
00000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
0000190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001b0: 0000 0000 0000 0000 0000 0000 0000 00fe  ................
00001c0: ffff eefe ffff 0100 0000 afc2 e70e 0000  ................
00001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00001f0: 0000 0000 0000 0000 0000 0000 0000 55aa  ..............U.
sh-3.2# diskutil  info  disk1s1
   Device Identifier:        disk1s1
   Device Node:              /dev/disk1s1
   Part of Whole:            disk1
   Device / Media Name:      Untitled 1

   Volume Name:              Not applicable (no file system)

   Mounted:                  Not applicable (no file system)

   File System:              None

   Partition Type:           Microsoft Reserved
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 SATA
   SMART Status:             Verified
   Disk / Partition UUID:    4DE8F5CA-515E-471A-8176-28E3ADC70B13

   Total Size:               134.2 MB (134217728 Bytes) (exactly 262144 512-Byte-Units)
   Volume Free Space:        Not applicable (no file system)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         Not applicable (no file system)
   Ejectable:                No

   Whole:                    No
   Internal:                 Yes
   Solid State:              No

sh-3.2# ls  -l  "/Volumes/Windows HD/Boot/BCD"
-rwxrwxrwx  1 _unknown  _unknown  28672 Apr 28 01:37 /Volumes/Windows HD/Boot/BCD

Best Answer

I can see two problems.

  1. The MBR partition table on disk 1 has the wrong values.
  2. disk1s1 does not belong and should be removed.

I will show how to fix the first problem.

  1. Open the Script Editor application and open a new empty window. The preferences show I am using "Script Editor (2.7)" and "AppleScript (2.4)" as defaults.
  2. Paste the following code in to the window.

    use scripting additions
    property disk : 1
    property mypassword : ""
    
    on fixmbr()
    
        script tm
            on subtract(x as text, y as text)
                return (x - y) as text
            end subtract
            on add(x as text, y as text)
                return (x + y) as text
            end add
        end script
    
        script mbr
            property table : {¬
                {id:"EE", guid:"C12A7328-F81F-11D2-BA4B-00A0C93EC93B"}, ¬
                {id:"07", guid:"EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"}, ¬
                {id:"AF", guid:"48465300-0000-11AA-AA11-00306543ECAC"}, ¬
                {id:"AB", guid:"426F6F74-0000-11AA-AA11-00306543ECAC"}, ¬
                {id:"AC", guid:"53746F72-6167-11AA-AA11-00306543ECAC"}, ¬
                {id:"00", guid:"E3C9E316-0B5C-4DB8-817D-F92DF00215AE"}}
    
            property entry1 : {id:"00", active:"-", start:"0", size:"0"}
            property entry2 : {id:"00", active:"-", start:"0", size:"0"}
            property entry3 : {id:"00", active:"-", start:"0", size:"0"}
            property entry4 : {id:"00", active:"-", start:"0", size:"0"}
            property entry : {entry1, entry2, entry3, entry4}
    
            on MapGUIDToId(guid as text)
                repeat with pair in table
                    if guid is guid of pair then return id of pair
                end repeat
                log "error"
            end MapGUIDToId
            on MapIdToGUID(id as text)
                repeat with pair in table
                    if id is id of pair then return guid of pair
                end repeat
                log "error"
            end MapIdToGUID
        end script
    
        set output to do shell script "gpt -r show /dev/disk" & disk password mypassword with administrator privileges
    
        set AppleScript's text item delimiters to {" "} --, "GPT part -"}
        set i to 0
    
        set rows to paragraphs in output
        --showValue of sv for rows
        set foundActive to false
        set j to 0
        repeat with row in rows
    
            set columns to {}
            repeat with x in text items in row
                if x is not in {""} then
                    set end of columns to contents of x
                end if
            end repeat
    
            if length of columns is 7 and {"GPT", "part", "-"} is in columns then
                --showValue of sv for columns given minCount:12
                set i to i + 1
                set ind to (item 3 of columns) as integer
    
                if i is not equal to ind then
                    log "error"
                else if j is 0 and item 7 of columns is MapIdToGUID("EE") of mbr then
                    set j to 1
                    --log "found " & i & " for entry " & j
    
                    set partStart to item 1 of columns
                    set partSize to item 2 of columns
                    set partSize to add(partSize, partStart) of tm
                    set partStart to "1"
                    set partSize to subtract(partSize, partStart) of tm
    
                    set id of entry1 of mbr to "EE"
                    set start of entry1 of mbr to partStart
                    set size of entry1 of mbr to partSize
                else if 0 < j and j < 4 then
                    set j to j + 1
                    --log "found " & i & " for entry " & j
                    set entry to item j of entry of mbr
    
                    set id of entry to MapGUIDToId(item 7 of columns) of mbr
                    set start of entry to item 1 of columns
                    set size of entry to item 2 of columns
                    if not foundActive and id of entry is "07" then
                        set active of entry to "*"
                        set foundActive to true
                    end if
                end if
            end if
        end repeat
    
        set i to 0
        set input to {}
        repeat with ent in entry of mbr
            if id of ent is "00" then exit repeat
            set i to i + 1
            set end of input to "edit " & i & linefeed
            set end of input to id of ent & linefeed
            set end of input to "n" & linefeed
            set end of input to start of ent & linefeed
            set end of input to size of ent & linefeed
            if active of ent is "*" then
                set end of input to "flag " & i & linefeed
            end if
        end repeat
        set end of input to "q" & linefeed & "y" & linefeed
        set AppleScript's text item delimiters to {}
        set input to input as text
        --log linefeed & input
    
        set command to "fdisk -e /dev/disk" & disk & " << EOF" & linefeed & input & "EOF"
    
        log linefeed & command
    
        set output to do shell script command with administrator privileges
        log output
        display dialog "The script has finished." buttons {"OK"}
        return 0
    end fixmbr
    fixmbr()
    
  3. Click the "Run" button. The script should prompt you for your login password. When the script finishes, you should get the following pop up window.

  4. Quit the Script Editor and enter the following command at a Terminal window.

    sudo  fdisk  /dev/disk1
    

    The result should be the same as shown below.

    Disk: /dev/disk1    geometry: 121601/255/63 [1953525168 sectors]
    Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: EE    0   0   2 - 1023 254  63 [         1 -     673791] <Unknown ID>
     2: AC 1023 254  63 - 1023 254  63 [    673792 - 1751953408] <Unknown ID>      
     3: AB 1023 254  63 - 1023 254  63 [1752627200 -    1269760] Darwin Boot     
    *4: 07 1023 254  63 - 1023 254  63 [1754306560 -  199217152] HPFS/QNX/AUX
    

If everything worked out, you can quit the Terminal application and try booting Windows. If Windows still will not boot, let me know and we can try to fix the second problem.

Expanation

There are two partition schemes that are important here. They are the Master Boot Record (MBR) partitioning scheme and the Globally Unique Identifier (GUID) partitioning scheme. The MBR scheme contains a MBR Partition Table which allows for the definition of only 4 partitions. The GUID scheme contains the same 4 entry MBR Partition Table and a GUID Partition Table (GPT) whose length is determined at time of creation. This value is typically much larger than 4 entries.

When a disk is partitioned using the GUID scheme, only the first entry is used in the MBR table. On your, disk this table contained the following data.

Disk: /dev/disk1    geometry: 121601/255/63 [1953525168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 - 1953525167] <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      

The id of EE indicates the disk is GUID partitioned and the GPT should be used to determine partitioning. The next six columes (Starting/Ending cyl/hd/sec) exist for legacy purposes. Experience has taught me that on Mac computers, it does not matter what values are in these six columns. In your case, the first three contain the lowest possible valid values and the next three contain the highest possible valid values. What is important is the start and size columns. Your disk is divided into 1953525168 sectors where each sector is 512 bytes. The first sector is numbered 0 and contains the MBR which also contains the MBR table. The partition with the EE id is defined to cover the rest of the disk. This gives older legacy partitioning software the impression all space has been allocated on the disk. This is why you will see the phrase Protective Master Boot Record (PMBR) in other documentation.

Below is a partial list of the contents of the GPT on your disk.

       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34      262144      1  GPT part - E3C9E316-0B5C-4DB8-817D-F92DF00215AE
      262178        2014         
      264192      409600      2  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      673792  1751953408      3  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  1752627200     1269760      4  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  1753896960      409600         
  1754306560   199217152      5  GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7
  1953523712        1423         
  1953525135          32         Sec GPT table
  1953525167           1         Sec GPT header

Each table entry is 128 bytes long. Since the table occupies 32 sectors, one can compute the table can hold around 32 * 512 / 128 = 128 entries. (Actually, 128 is the default according to the man page documentation.) Note, there is a backup table/header at the end of the disk. The GUID's correspond to the following types of partitions.

E3C9E316-0B5C-4DB8-817D-F92DF00215AE = Microsoft Reserved             
C12A7328-F81F-11D2-BA4B-00A0C93EC93B = EFI 
53746F72-6167-11AA-AA11-00306543ECAC = Apple_CoreStorage   
426F6F74-0000-11AA-AA11-00306543ECAC = Apple_Boot
EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 = Microsoft Basic Data 

Normally, the Disk Utility application hides the EFI and Apple_Boot partitions. The Microsoft Reserved partition does not belong and should be removed. The EFI partition usually occurs first. It is not used to boot the OS X operating system, but is required by OS X for other uses. The Apple_CoreStorage partition contains most of your OS X "Macintosh FD" volume. The Apple_Boot partition (I believe) contains your "Bootable Recovery Partition". The software, contained in this partition, is the replacement for the recovery software that was on the installation DVD. Finally, Microsoft Basic Data partition contains your Windows volume.

On your Mac, Windows requires a MBR scheme which is a conflict since OS X uses a GUID scheme. The following changes were necessary to the MBR partition table to fool Windows in to thinking your computer is using a MBR scheme.

  1. The size of the EE partition was adjust to just cover the EFI partition.
  2. Data was copied from the GPT to the MBR partition table. The was done for first three partitions that followed the EFI partition. In your case, this was the rest of the partitions. The start and size were copied exactly. Each GUID was translated to an id. I would give a translation table, but unfortunately not all the translations are one-to-one.
  3. The windows partition was marked as active. Active means boot to this partition. When printing the MBR partition table, the active partition is marked with an * character.

When corrected the MBR partition table should appear as follows.

Disk: /dev/disk1    geometry: 121601/255/63 [1953525168 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE    0   0   2 - 1023 254  63 [         1 -     673791] <Unknown ID>
 2: AC 1023 254  63 - 1023 254  63 [    673792 - 1751953408] <Unknown ID>      
 3: AB 1023 254  63 - 1023 254  63 [1752627200 -    1269760] Darwin Boot     
*4: 07 1023 254  63 - 1023 254  63 [1754306560 -  199217152] HPFS/QNX/AUX

The command that was used to make the changes to this table on your disk is called fdisk. The values for the Starting/Ending cyl/hd/sec where chosen by the command. Other than flagging partition 4 as active, the script you ran only entered the id, start and size values.

To be more precise, the exact command was sudo fdisk -e /dev/disk1. The interactive commands were edit, flag and quit. A description of fdisk can be found at this OS X Man Page. (Or by typing man fdisk in a Terminal window.)