Time and space

My MacBook Pro has a 500GB solid-state drive. (Technically 512GB, I suppose, but it reserves all the rest to replace blocks as they fail. I’m okay with that.) When I first got this computer, I decided to allocate 380 gigs of that to Mac OS, and the remaining 120 gigs to Windows, because I like being able to dual-boot into Windows when I want to help someone with Windows or play a game.

Turns out that I don’t use much storage on the Mac side; I prefer to keep most of my data on my desktop, where it’s more secure. But meanwhile, Windows games are big and I have a bunch of them (darn Steam sales), so I was running out of room on the Windows side.

So I decided to shrink the Mac partition and expand the Windows partition, to give them each 250 gigs.

Shrinking the Mac partition was surprisingly easy. Disk Utility has a nice graphic interface for it, and I didn’t even have to reboot. Then I went into Windows and tried to expand its partition to use the space I had just opened up … but it wouldn’t let me. Long story short: Windows looks for its system files at a specific offset from the start of the disk. So I can only expand a Windows partition “to the right” (moving the end of the partition), not “to the left” (moving the start). Hmm.

A little searching turned up a solid GNU utility, “gparted”, the GNU Partition Editor. It’s a handy little tool that can do all sorts of tricks including moving a partition! I backed up everything, shrank the Windows partition in preparation to move it, then set up a USB flash drive with gparted, booted into it, and moved the partition. No problem at all.

… until I tried rebooting into Windows, and was faced with error 0xc000000e. Uhoh.

Found information about this being a “BCD” error, whatever that is; found instructions about how to run “bootrec.exe /rebuildbcd” to fix it. Only, that kept giving me errors; when I was booted from the Windows 10 recovery CD, it couldn’t even see my C: partition.

Welcome to an Apple quirk! An Intel Mac uses EFI, but Mac OS syncs the GPT partitioning scheme to a simplified MBR partitioning scheme for Windows to use. When I was booted into gparted I had updated the partitions in GPT, but the MBR side of things wasn’t aware that anything had changed. After some panic, I discovered that I could fix this by booting into gparted again and running “gptsync /dev/sda“.

Except that it failed because two partitions were “unknown.” More research ensued. Turns out they were both small Windows rescue partitions, one from Windows 8, the other from Windows 10. I decided I was far beyond the point of rescue, so I deleted them, and gptsync worked.

But Windows would still not boot. (Error 0xc0000225, now.)

Back to that bootrec thing. When I booted into the Windows 10 recovery CD I could now could see C:, and could even see the contents of it, and chkdsk c: passed successfully, but bootrec /rebuildbcd insisted the partition was corrupt. I found an article at http://superuser.com/questions/241739/windows-7-cannot-boot-bootrec-reports-fs-not-found-or-corrupt which listed steps to fix that. It worked. (The whole purpose of this article was to link to this one page, because I’m sure at some point I’ll need it again.)

Remember I said I shrank the Windows partition? Now I expanded it to 250GB to take all the additional space. As with resizing the Mac partition, it was instant and didn’t require a reboot. Small victories!

But now Disk Utility on the Mac side showed the Windows partition as having a negative size, and then it crashed. I didn’t much like this. Turns out that Windows had modified the MBR partition table, and now I had to update the GPT partition table to match. Not the same process; I found good instructions at http://apple.stackexchange.com/questions/198830/upgrade-to-yosemite-failed-mbr-and-gpt-dont-match. (Again, linking here ‘cos I’m sure I’ll need it again someday.)

Now everything looked good … except that my Windows partition has an offset of 512 blocks, which means it’s out of alignment and will incur a performance hit. I followed the instructions at http://lifehacker.com/5837769/make-sure-your-partitions-are-correctly-aligned-for-optimal-solid-state-drive-performance to move the partition, but then I had to repeat several of the above steps to update the partition tables and the Windows BCD (Boot Configuration Data). By now I was getting to be a pro at this. For some reason the Windows partition still has an offset of 512 blocks even though I moved it. No idea why, or whether that’s really a problem.

And that’s not even the whole story. gparted tells me “the backup GPT table is corrupt”, though gdisk says it’s okay. And Windows at one point added a bunch of icons to my EFI boot screen, though http://apple.stackexchange.com/questions/225092/ghost-partition-windows-bsod showed me how to get rid of them.

So at this point, despite many more hours, more panic, and more despair than I was counting on, I achieved my goal of repartitioning my disk space, I believe everything is working once more, and I learned a lot along the way.

And this wasn’t even my Hackintosh! Remind me to tell you sometime of the weekend I spent wresting with the UEFI Compatibility Support Module so that I could have a nice-looking boot screen.

Leave a Reply

Scroll to Top