Categories
Tech

Restoring to a single partition after installing Linux with Boot Camp

I recently installed Linux on my Macbook with Boot Camp. I recently decided to use a virtualization solution instead, and wanted to get that space back. When I ran Boot Camp, it wouldn’t combine my partitions together, possibly because I put Linux on there, instead of Windows, and it changed the partition type.

Using this article, I fixed it and successfully combined everything.

IF YOU FOLLOW THESE INSTRUCTIONS, AND YOU LOSE ALL YOUR DATA AND YOUR MOM MAKES YOU MOVE OUT, IT IS NOT MY FAULT.

If you decide to do what I did, please understand what you’re doing. Please read all applicable man pages, and have recent backups.

I booted into the Mac Install CD, and opened the Terminal. Using gpt show disk0 and diskutil list /dev/disk0 and diskutil info /dev/disk0, I confirmed a little bit about how my disk was being managed. My Linux partitions were /dev/disk0s3 and /dev/disk0s4, which corresponded to gtp indexes 3 and 4.

I used gpt remove -i 3 disk0 and gpt remove -i 4 disk0 to remove the gpt entries.

I ran diskutil resizeVolume disk0s2 limits to find out how large I could make the original partition. I then tried to run diskutil resizeVolume disk0s2 *maximum size* but diskutil told me it couldn’t resize it. I rebooted, back into the cd again, and ran the diskutil resizeVolume disk0s2 *maximum size*. It succeeded, I rebooted, and I had my space back.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.