Repartitioning Bootcamp

Discussion in 'Windows, Linux & Others on the Mac' started by ImMrE, Apr 14, 2012.

  1. ImMrE macrumors newbie

    Apr 14, 2012
    I used bootcamp to partion my disk and installed windows 7.
    I have a 1 tb HD and split it 800 for Lion and 200 for Windows.
    All was fine. Everything worked as expected.
    My son (I gotta blame someone!) downloaded a bunch of windows games that used up the windows partition, so I decided to repartition the disk 500 gb for each OS. (using bootcamp)
    I backed up everything (Time machine for Lion and Windows System Restore and Norton Ghost on the Windows side.)
    I use bootcamp to repartition the HD to 500 per partition- but when I restore windows to the hard drive-(from my backup) bootcamp dissappears and Lion Disk Utility thinks the disk is spilt 800/200 again. I can shrink the Lion to 500 gb but I am unable to change the MS partition. (Greyed out)
    By restoring using Norton Ghost- I was able to keep the disk 500 per partition according to Windows explorer (and I think it is correct- since I now have more than 200gb loaded) but the Lion disk utility doesn't agree still thinks it's 800/200 and it's not a bootcamp partition.
    I am able to boot into windows by holding down the option key at startup- but the windows disk does not show up in the system preferences in Lion to choose startup disk.

    Any ideas on how I can re-establish bootcamp?
    Is there a way to restore Windows without it repartitioning the drive in the process?

    My ultimate goal is to install and use Parallels 7 again.
    FYI - I am a complete non-techie- so be gentle with me.
    I am happy to provide more information if that is necessary.
  2. murphychris macrumors 6502a

    Mar 19, 2012
    Terminal application, type the following commands, report back the results formatting using the code tags (highlight the text, use the # button on the toolbar).

    diskutil list
    sudo fdisk /dev/disk0
    diskutil resizevolume /dev/disk0s2 limits
    The second command will require an admin user/password.
  3. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    Repartitioning Bootcamp

    0: GUID_partition_scheme *1.0 TB disk0
    1: EFI 209.7 MB disk0s1
    2: Apple_HFS Untitled 1 800.0 GB disk0s2
    3: Microsoft Basic Data 199.9 GB disk0s3

    Disk: /dev/disk0 geometry: 121601/255/63 [1953525168 sectors]
    Signature: 0xAA55
    Starting Ending
    #: id cyl hd sec - cyl hd sec [ start - size]
    1: EE 1023 254 63 - 1023 254 63 [ 1 - 409639] <Unknown ID>
    2: AF 1023 254 63 - 1023 254 63 [ 409640 - 974609344] HFS+
    3: AB 1023 254 63 - 1023 254 63 [ 975018984 - 1269536] Darwin Boot
    *4: 07 1023 254 63 - 1023 254 63 [ 976289792 - 977233920] HPFS/QNX/AUX

    For device disk0s2 Untitled 1:
    Current size: 800.0 GB (799999983616 Bytes)
    Minimum size: 290.1 GB (290068189184 Bytes)
    Maximum size: 800.0 GB (800000552960 Bytes)

    Additional info:
    Windows Explorer Reports 2 drives
    c: 269 free of 465gb
    e: 206 free of 464gb

    Any suggestions are welcome.

  4. murphychris macrumors 6502a

    Mar 19, 2012
    OK it's harder to read this when you don't format with code tags like requested. While I don't mean to sound like a dick, the significance of you not following directions, or asking for clarification first, on something this simple, is that it tells me I can't give you more advanced command-line instructions to try and get you out of this mess, because I'm not sure you'll follow them precisely.

    Your Mac HD's name is "Untitled 1"?

    The GPT clearly says the Mac volume is 800GB, and the Windows volume is 200GB. The JHFS+ filesystem is reporting that it's 800GB. Since those two are in agreement, the Windows side has somehow become confused if it's seeing two disks, and each one is well over 200GB. This is a potentially very hazardous situation if Windows literally thinks it has 400+GB available to it (where?) let alone two separate disk letters. I highly recommend you make backups of your most important data, I'd be very alarmed by Mac OS saying its volume is 800GB, while Windows says it has two 450+ GB volumes, while you have a single 1TB disk. Very alarmed, because this doesn't add up.

    The easiest, yet most tedious way to fix this problem after a backup (for Mac OS preferably a Time Machine backup) is to reboot off a Lion install DVD, go to Disk Utility and repartition the disk with 1 partition. Explicitly choose 1 partition, not Current.

    Then reinstall Lion.

    Then once it reboots twice, during the initial setup you'll get the option to restore from a Time Machine backup.

    Then I'd install all Mac OS updates.

    Then I'd use Boot Camp Assistant to resize the disk however you want, 500/500. Then reinstall Windows. Then reinstall your Windows apps and data.

    As for command line methods to do this, I'd use gdisk and disktutil to blow away the highly suspect Windows partition. Resize the Mac OS partition to 500GB. And then create a new Windows partition and hybrid MBR using gdisk. Then reinstall Windows. i.e. it would save you from having to reinstall Mac OS.


    There is a scant chance the Windows side could be salvaged by using gdisk to create a new hybrid MBR. But seriously, if you get the entries wrong, it is a command line only tool after all, you will hose both Windows and Mac OS sides. So before I go to the trouble writing out what to do I'm going to wait and see if you even remotely interested in going down that road, i.e. by telling me you have a backup, and you don't care if you hose everything on the disk, and that you're going to follow directions exactly.

    The worst that happens is you have to reinstall everything anyway. Best scenario is maybe it'll work and you won't have to.
  5. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    Repartitioning Bootcamp

    I apologize for not using the hash tags. I had no idea it reports differently than just copying it. I am new to Mac- so please forgive me.

    Yes - My Mac HD is "Untitled 1"

    To be clear:
    I have previously wiped out the Windows side (Gone back to 1 partition) and I then used Bootcamp to and split the HD into 2 equal partitions- my problem occurs when I do a system restore from my backup. Doing a system restore seems to repartition the hard drive and wipes out bootcamp instead of just copying the files over.
    I guess my question: Is there a way to "reinstall my Window apps and data"- without doing a complete system restore? (I know I can do it 1 app at a time - but I am trying to avoid this)

    I have wiped out the entire hard disk and re-installed Lion already. The problem occurs when I try to restore windows.

    I have current backups so I don't mind if the data gets erased again and I have to start from scratch.

    I appreciate your effort on this.
  6. murphychris macrumors 6502a

    Mar 19, 2012
    What is the result of:

    sudo gpt -r show /dev/disk0
  7. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    Repartitioning Botcamp

    gpt show: /dev/disk0: Suspicious MBR at sector 0
    gpt show: error: bogus map
    gpt show: unable to open device '/dev/disk0': Undefined error: 0
    Did I do that right? (Not familiar with the code format thing -I am trying!)
  8. murphychris, Apr 15, 2012
    Last edited: Apr 15, 2012

    murphychris macrumors 6502a

    Mar 19, 2012
    Yes you're doing better. But gpt is being irritatingly unhelpful. Try

    sudo gpt -r -vvv show /dev/disk0
  9. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    Repartitioning Bootcamp

    gpt show: /dev/disk0: mediasize=1000204886016; sectorsize=512; blocks=1953525168
    gpt show: /dev/disk0: Suspicious MBR at sector 0
    gpt show: /dev/disk0: MBR part: type=175, start=409640, size=974609344
    gpt show: /dev/disk0: MBR part: type=171, start=975018984, size=1269536
    gpt show: /dev/disk0: MBR part: type=7, start=976289792, size=977233920
    gpt show: /dev/disk0: Pri GPT at sector 1
    gpt show: /dev/disk0: GPT partition: type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, start=40, size=409600
    gpt show: /dev/disk0: GPT partition: type=48465300-0000-11AA-AA11-00306543ECAC, start=409640, size=1562499968
    gpt show: error: bogus map
    gpt show: unable to open device '/dev/disk0': Undefined error: 0
  10. murphychris macrumors 6502a

    Mar 19, 2012
    1. There's a good chance that the primary or secondary or both GPTs are corrupt.

    2. I see no evidence your disk was ever resized to 500/500. It is still 800/200 according to the GPT and diskutil's resizevolume limits analysis.

    3. The GPT is missing the Recovery HD. It's simply been blown away. I don't know what utility did this. It's not a big problem, but it means you don't have a way to use FileVault 2, or boot from Recovery HD.

    4. The GPT is also missing the Windows partition.

    5. The MBR still has an entry for Recovery HD, and the Windows partition.

    6. The MBR 4th partition, for Windows, has a bogus size that extends outside the last sector of the disk, claiming it's 465GB.

    Those are the facts at this point.

    Unknown is what caused all of this. I just did this in Lion 10.7.3 and it correctly obliterated the MBR, and remerged the Windows portion.

    So the next question is how to fix this. As I mentioned earlier, the easiest although most tedious way to fix this is to boot from a Lion DVD, and repartition the disk as 1 partition - this creates a whole new GPT from scratch. Reinstall the OS. Restore your backup and update the system. Use Boot Camp Assistant to resize the disk however you want it separated. Reinstall Windows. Restore the data from backup. I think I'm suspicious of those restore tools because it sounds like they are screwing around with the MBR and that is very bad in this case.

    With Windows on a dedicated computer, there would only be an MBR. So it's reasonable for a backup-restore utility to restore the partition map, and the boot block, etc. But the problem is that a Boot Camp configured Mac has two partitions, MBR for Windows usage, and GPT for Mac OS. The problem is that some tools, like possibly one of these Windows backup-restore utilities are assuming they have complete authority to restore the disk to a previous condition and thus ignore the protective MBR and the GPT.

    Fixing your problem with command line tools is possible, probably without having to reinstall Mac OS, maybe not even having to reinstall Windows. But it will be tedious to go through myriad steps.
  11. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    Thank you for your help and analysis.
    I think I might wipe everything out and try over.
    I will install Windows 7 and try to see if Norton Ghost will copy over the program files and apps individually.

    Here is the only evidence I can find that at one point the HD was 500gb.
    (I have no idea why it disagrees with everything else.)
    Notice the available and used add up to 500gb even tho it says the capacity is 800 gb
    From the disk utility - clicking on Untitled1 - info at the bottom.

    Mount Point : / Capacity : 800 GB (799,999,983,616 Bytes)
    Format : Mac OS Extended (Journaled) Available : 219.38 GB (219,381,301,248 Bytes)
    Owners Enabled : Yes Used : 279.62 GB (279,618,682,880 Bytes)
    Number of Folders : 235,705 Number of Files : 1,098,446

    Does that change anything?

    Also- I have access to another Mac - so I can open this Mac in Terminal mode. (Not sure if that is useful)
  12. murphychris macrumors 6502a

    Mar 19, 2012
    It just makes things even more disturbing that something went wrong in the mergepartition sequence, because 'diskutil resizevolume limits' clearly thinnks the file system current size is 800GB. 'diskutil list' says the same thing. GPT says the same thing. But Disk Utility is getting other information from who knows where.

    What do these commands reveal?

    df -h
    diskutil info /dev/disk0s2
  13. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    df -h

    Filesystem      Size   Used  Avail Capacity  Mounted on
    /dev/disk0s2   465Gi  260Gi  204Gi    57%    /
    devfs          183Ki  183Ki    0Bi   100%    /dev
    map -hosts       0Bi    0Bi    0Bi   100%    /net
    map auto_home    0Bi    0Bi    0Bi   100%    /home
    diskutil info /dev/disk0s2

       Device Identifier:        disk0s2
       Device Node:              /dev/disk0s2
       Part of Whole:            disk0
       Device / Media Name:      iMac
       Volume Name:              Untitled 1
       Escaped with Unicode:     Untitled%FF%FE%20%001
       Mounted:                  Yes
       Mount Point:              /
       Escaped with Unicode:     /
       File System Personality:  Journaled HFS+
       Type (Bundle):            hfs
       Name (User Visible):      Mac OS Extended (Journaled)
       Journal:                  Journal size 81920 KB at offset 0x1d1c000
       Owners:                   Enabled
       Partition Type:           Apple_HFS
       OS Can Be Installed:      Yes
       Media Type:               Generic
       Protocol:                 SATA
       SMART Status:             Verified
       Volume UUID:              13630CA2-7A77-338B-ADC8-14D7CC5EFBD2
       Total Size:               800.0 GB (799999983616 Bytes) (exactly 1562499968 512-Byte-Blocks)
       Volume Free Space:        219.4 GB (219376660480 Bytes) (exactly 428470040 512-Byte-Blocks)
       Device Block Size:        512 Bytes
       Read-Only Media:          No
       Read-Only Volume:         No
       Ejectable:                No
       Whole:                    No
       Internal:                 Yes
       Solid State:              No
  14. murphychris macrumors 6502a

    Mar 19, 2012
    Interesting. df sees the volume as 465G, diskutil sees the partition as 800. Both see the same free space. So diskutil resizevolume limits must see the partition size, not the filesystem size.

    I will speculate something interrupted the resize process. The GPT was modified, the MBR perhaps also was not (or was later replaced with a Windows backup restore), but the file system was not successfully resized.

    I'd say you've run into a nasty collision of events that are probably somewhat rare, at least on the Mac side. Usually, even if something can be done at command line, the GUI simply won't allow it because users get into too much trouble. So GUI stuff tends to be really conservative and works. Anyway, definitely make sure when you boot the Lion disk, you go into its Disk Utility and repartition (not erase) the disk, and make sure you choose 1 Partition, not the default which will be set to Current.


    The other possibility is that some tools are looking at the MBR and others are looking at the GPT. It might very well be the file system is 465G and has been resized. I really can't tell what's correct, which is another reason why you're better off starting over from scratch.
  15. ImMrE thread starter macrumors newbie

    Apr 14, 2012
    I will follow your instructions. I appreciate your help.

Share This Page