Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Tried to partition hard drive and lost Windows

Hi everybody,


I tried to change my partition size to allow more space for Windows without realizing that it would ruin my Windows half. Now when I try to boot into Windows, I get "Missing Operating System"


HELP!


Thanks, Harry

MacBook Pro, OS X Yosemite (10.10.3)

Posted on Aug 4, 2015 4:17 PM

Reply
43 replies

Aug 4, 2015 10:51 PM in response to xHarry777

Okay, it's done!

Results:

Disk /dev/disk0 - 500 GB / 465 GiB - 976773168 sectors (RO)


The harddisk (500 GB / 465 GiB) seems too small! (< 2589 GB / 2411 GiB)

Check the harddisk size: HD jumpers settings, BIOS detection...


The following partitions can't be recovered:

Partition Start End Size in sectors

> Mac HFS 598748676 1197087715 598339040

MS Data 822568208 978816271 156248064

Mac HFS 950993010 2110883513 1159890504 [ffFFFfFf6Sd6ffff

Mac HFS 951602807 5057119628 4105516822

MS Data 976773112 1268273136 291500025

MS Data 976773119 1141319671 164546553

Mac HFS 976773124 978042659 1269536


Aug 5, 2015 6:30 AM in response to Loner T

Correct list:

Disk /dev/disk0 - 500 GB / 465 GiB - 976773168 sectors (RO)

Partition Start End Size in sectors

>D EFI System 40 409639 409600 [EFI]

D EFI System 46 409645 409600 [EFI]

D Mac HFS 409640 598748679 598339040

D Mac HFS 1253938 599592977 598339040

D Mac HFS 1254410 599593449 598339040

D Mac HFS 1255154 599594193 598339040

D Mac HFS 1256034 599595073 598339040

D Mac HFS 1256410 599595449 598339040

D Mac HFS 1257010 599596049 598339040

D Mac HFS 1257770 599596809 598339040

D Mac HFS 1258242 599597281 598339040

D Mac HFS 1258818 599597857 598339040

Structure: Ok. Use Up/Down Arrow keys to select partition.

Use Left/Right Arrow keys to CHANGE partition characteristics:

P=Primary D=Deleted

Keys A: add partition, L: load backup, T: change type, P: list files,

Enter: to continue

FAT32, blocksize=512, 209 MB / 200 MiB

Aug 5, 2015 7:36 PM in response to xHarry777

Looked at the entire list. Very glad you did it this way, it saved me quite a bit of scrolling. 😉


This is a table I build to try and verify the partition table. The logic followed is explained below (this serves as documentation for future readers as well).


User uploaded file


1. All these numbers are addresses of 512-byte sectors on disk.

2. The NTFS Size value occurs repeatedly, as does the GPT3 size value. This is because when a partition is moved, it leaves a 'vapor' trail behind (like a Jet contrail). This is the history of sector movement.

3. GPT3 is Recovery HD. It is between OS X and Bootcamp partitions. It has to be moved silently, anytime the user-visible partitions are moved. Hence you see a large number of entries.

4. Using the NTFS Size as the magic number, after the GPT3 entry (because it was originally after Recovery HD), the above table is built.

5. The last piece used is that this partition ends close to the end of the disk. Your disk is 976773168 sectors and the NTFS End is close to it allowing for backup GPT tables and sector alignment (the SEC GPT Table entries).


Q1. Does the NTFS Size (GB) come close to your original Windows partition. I use 1024 instead of the storage industry 1000 for kb/mb/gb/tb size calculations.

Q2. Was he resize amount close to 93+ GB?


If the answer to both questions is a yes, we can proceed further. The next step is get to this entry

D MS Data 685273088 976773112 291500025

in your list and use 'P' to list files. The output should similar to


User uploaded file

Aug 5, 2015 7:55 PM in response to Loner T

Yes to both!


This is what I get when I press p:

MS Data 685273088 976773112 291500025

Directory /


>dr-xr-xr-x 0 0 0 4-Aug-2015 02:12 .

dr-xr-xr-x 0 0 0 4-Aug-2015 02:12 ..

dr-xr-xr-x 0 0 0 30-Apr-2015 08:11 $Recycle.Bin

dr-xr-xr-x 0 0 0 30-Apr-2015 08:43 .Trashes

dr-xr-xr-x 0 0 0 30-Apr-2015 19:22 Boot

dr-xr-xr-x 0 0 0 2-Jun-2014 08:25 Intel

dr-xr-xr-x 0 0 0 2-Jun-2014 09:41 MSOCache

dr-xr-xr-x 0 0 0 1-May-2015 18:31 PSFONTS

dr-xr-xr-x 0 0 0 13-Jul-2009 23:20 PerfLogs

dr-xr-xr-x 0 0 0 13-Jul-2015 19:17 Program Files

dr-xr-xr-x 0 0 0 28-Jul-2015 22:39 Program Files (x86)

dr-xr-xr-x 0 0 0 4-Aug-2015 02:11 ProgramData

dr-xr-xr-x 0 0 0 30-Apr-2015 08:03 Recovery

dr-xr-xr-x 0 0 0 30-Apr-2015 08:12 Scripts

dr-xr-xr-x 0 0 0 13-Jul-2015 19:04 System Volume Information

dr-xr-xr-x 0 0 0 30-Apr-2015 08:12 Users

dr-xr-xr-x 0 0 0 18-Jul-2015 12:51 Windows

-r--r--r-- 0 0 8192 2-Jun-2014 15:54 BOOTSECT.BAK

-r--r--r-- 0 0 2060 2-Jun-2014 08:20 RHDSetup.log

-r--r--r-- 0 0 383786 20-Nov-2010 22:23 bootmgr

-r--r--r-- 0 0 10 30-Apr-2015 07:54 casperImagingTarget

-r--r--r-- 0 0 8492101632 4-Aug-2015 18:22 pagefile.sys




Aug 5, 2015 8:22 PM in response to xHarry777

Install GPT Fdisk (aka gdisk). Leave your Testdisk display and start a new Terminal Window. You need to use the following steps. If you see any error messages during the following steps, please stop and post back here with the error message. The following steps have values from your Testdisk output (and you can verify) in Steps 7 and 8. Please notice the'+' sign in step 8 (this is called offset notation). The text in parentheses is for informational purpose to describe the action being taken. Gdisk has one-character commands except when entering numbers.


Rebuild GPT4 using start/end offsets


  1. Sudo gdisk /dev/rdisk0
  2. P (print the full list of parts)
  3. D (delete)
  4. 4 (part 4)
  5. N (new part)
  6. 4 (part 4)
  7. 685273088 ( - Start offset in sectors or the start point for Bootcamp part)
  8. +291500025 ( - Size offset, as opposed to End offset)
  9. 0700 (Windows part type)
  10. P (print list of all parts just to see what changes will be made)
  11. W (Write the new GPT)
  12. Y (Yes! really write the new GPT)

This will delete and re-write the GPT partition info for /dev/disk0s4.

Rebuild MBR to match the new GPT information thus resetting the Hybrid MBR. Use defaults for other questions (like partition codes). The only values that need modifications are the Boot flags and step 10. Accept all other defaults that Gdisk offers. Please see thesample Q&A as an example. These steps can be repeated if you make a mistake before you get to Step 12, otherwise start from Step 1 for these steps. Step 6 has numbers which are typed with a space between the numbers.

  1. Sudo gdisk /dev/rdisk0
  2. P (Print list of parts)
  3. R (Recover)
  4. O (print current Hybrid MBR)
  5. H (chooses Hybrid)
  6. Partitions numbers to be hybridized: 2 3 4
  7. Y (Good for GRUB question)
  8. N (part 2 boot flag)
  9. N (part 3 boot flag)
  10. Y (part 4 boot flag make NTFS bootable partition)
  11. O (print current Hybrid MBR)
  12. W (Write the new MBR)
  13. Y (Yes! write the new MBR)
  14. Reboot


Here is sample Q&A for this section. Please notice the Press Enter/Return.


Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): Y


Creating entry for GPT partition #2 (MBR partition #2)

Enter an MBR hex code (default AF): Press Enter/Return

Set the bootable flag? (Y/N): N


Creating entry for GPT partition #3 (MBR partition #3)

Enter an MBR hex code (default AB): Press Enter/Return

Set the bootable flag? (Y/N): N


Creating entry for GPT partition #4 (MBR partition #4)

Enter an MBR hex code (default 07): Press Enter/Return

Set the bootable flag? (Y/N): Y


Test 1 - Does Bootcamp Volume show up in Finder?

Test 2 - Can you see files in Bootcamp Volume?

Test 3 - Can you select Bootcamp in System Preferences -> Startup Disk?

Test 4 - If Test 3 is successful, select Bootcamp and Click Restart.

Aug 5, 2015 8:44 PM in response to Loner T

Here you go:

gpt show: /dev/disk0: mediasize=500107862016; sectorsize=512; blocks=976773168

gpt show: /dev/disk0: Suspicious MBR at sector 0

gpt show: /dev/disk0: Pri GPT at sector 1

gpt show: /dev/disk0: Sec GPT at sector 976773167

start size index contents

0 1 MBR

1 1 Pri GPT header

2 32 Pri GPT table

34 6

40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B

409640 488281248 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC

488690888 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC

489960424 195312664

685273088 291500025 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7

976773113 22

976773135 32 Sec GPT table

976773167 1 Sec GPT header

??? sudo fdisk /dev/disk0

Disk: /dev/disk0 geometry: 60801/255/63 [976773168 sectors]

Signature: 0xAA55

Starting Ending

#: id cyl hd sec - cyl hd sec [ start - size]

------------------------------------------------------------------------

1: EE 0 0 2 - 25 127 14 [ 1 - 409639] <Unknown ID>

2: 03 25 127 15 - 1023 254 63 [ 409640 - 488281248] XENIX /usr

3: AB 1023 254 63 - 1023 254 63 [ 488690888 - 1269536] Darwin Boot

*4: 07 1023 254 63 - 1023 254 63 [ 685273088 - 291500025] HPFS/QNX/AUX


Tried to partition hard drive and lost Windows

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.