Author Topic: [TUTORIAL] Resize partitions in a MBR/GPT hybrid setup [TUTORIAL]  (Read 11928 times)

0 Members and 1 Guest are viewing this topic.

eyvind

  • Member
  • Posts: 50
IMPORTANT: Before following this, make sure to backup important documents, as I cannot guarantee everything will go according to plan. I also only currently support or have knowledge about doing this procedure with Vista or Windows 7 and OSX. I am not sure about Linux or XP, but it should be possible.

Hey everyone, I am officially back. I left about 6 months ago due to moving to a new country. My desktop has finally arrived back, and now I am setting up Snow Leopard.

Anyway here is the guide:

Many people use an MBR/GPT hybrid, sometimes with a 200mb EFI partition. And sometimes, you want to resize one of the partitions (e.g. Mac partition, windows, linux, etc). Many people who are not acquainted with how MBR/GPT works try to either use MBR or GPT tools to resize. If you use a GPT tool, the gpt partitions will be resized, while the MBR will probably be emptied and cleared. This means you can't boot to windows. If you use an MBR tool, the MBR and GPT partitions may become out of sync, meaning data corruption.

Some background info:

MBR and GPT are two different "indexing" schemes for harddrives. When you write data to a harddrive, both the physical data is written to the correct place, as well as an index is writte, so programs and operating systems can find the files later on. MBR is a very old and outdated standard for indexing, but it is still used with all Windows distributions. Windows does not support GPT, unless you use a very unstable bootloader (google DUET) or you run special server hardware (neither of which are accessible to the average Joe). OSX uses GPT (GUID). Some people install OSX to MBR, but this requires a small hack of the installation files, which makes the install ""not"" vanilla (untouched). Therefore the easiest way to do this would be to have both MBR and GPT. The problem with this is that it is not very stable, and only supports 4 partitions in the MBR index (no logical drives work).  If you create the partitions using the OSX setup, a MBR/GPT hybrid will automatically be created.

Now, if you want to resize a GPT/MBR hybrid system, you will need to do the following:

1) Resize the partitions using a GPT partition editor. (E.g Gparted)
2) Update the MBR with the new partitions
3) Reinstall the MBR boot settings so windows can start.

Here was my setup:

MBR/GPT hybrid with the following partitions:

1) 200mb EFI partition (containing chameleon + kexts)
2) 50GB Windows drive (Windows folder)
3) 400GB Windows drive (Windows programs + User folder)
4) 400GB OSX drive (OSX things)

I wanted to make my Windows drive a bit bigger (700GB) and make the OSX drive a bit smaller (200GB). [I know these values arent exact, and dont seem to work, but they are from memory and not exact]

To do this, first I downloaded Gparted from http://partedmagic.com/download.html

I used the USB option, but the ISO burning works just as well.

Once you have either burned partedmagic to a disc or put it on your flash drive (instrutions for both are availabe on the partedmagic website), then go to ubuntu.com, and download the iso.

Burn the ISO, or install it to another USB.

Once this is done, go to  http://cybernetnews.com/windows-7-recovery-disc/ and get the recovery disk (this is assuming you have windows 7. Ones for vista are also available. I am not sure about XP, but there probably is a way to do this using a 3rd party repair tool.

Now that you have Partedmagic, Ubuntu and the Windows 7 Recovery disk you should reboot and load into partedmagic.

In partedmagic, open the partition Editor (or something similar, I can't remember the name). It should show the current partitions from the GPT index. Now right click the partition and resize it however you want. Click apply when you are done.

Now reboot into the Ubuntu live cd/dvd. Go to to http://www.rodsbooks.com/gdisk/ and you can read a bit about the tool. Once you have read, go to http://sourceforge.net/projects/gptfdisk/ to download gdisk. Make sure to download the correct version (64vs 32bit). Once you have done this, extract all the files, then go to the folder sbin (where you have extracted) and drag and drop gdisk into a terminal with sudo priveleges. Now gdisk should start, and ask you which drive. The default would be /dev/sda (the first HD). Now you should get to a command line. Type ? for help.

Now you should type p, and click enter. A list of partitions in the GPT index should show (they should already be resized).
Now type r to get to the recovery/transformation menu. Type o, and you should see the partitions in the MBR index (this should be empty, or have on partition since it has been cleared by Gparted. Now type h to setup a new Hybrid.

It will ask you to select which partitions you want (in my case 2 3 4, Window, Windows, OSX). It will automatically create the  200mb EFI partition (you dont need to select it). Make sure you click yes when it asks if you want the partition int he beginning of the drive. Now it will ask you question about the partitions it is creating (which partition type, and whether it shoudl be bootable). You can usually use the defaults, as it detects the types of the partitions automatically. Type yes when it asks if the windows drive should be flagged as boot. The rest shouldnt be flagged as boot. Once this is done, type w to write the changes to the disk.

If you restart gdisk and look at p, and o, they should be the same.

Now restart and boot your recovery disk. Go to startup repair, and the repair process should automatically find the windows partition and allow you to boot from it. Once in windows, you can use Easybcd: http://neosmart.net/dl.php?id=1 to add new booters, change the names of the entries, or repair the BCD storage (i think you might have to do this)

Remember: I take no responsibility for what happens if you use these instructions, but theoretically they should work (they worked for me). Make sure to backup data, and you can use this post as hints if you want to create your own method.


My new notebook:
MSI X-340, Slim as an Air
2 GB Ram, Intel 723 ULV processor (SSE3 capable), Intel 4500MHD Graphics
Running Windows 7 Ultimate 64bit, Ubuntu 9.10 64bit, Currently installing Snow Leopard Vanilla, BackTrack
Currently installing Snow Leopard Vanilla, BackTrack

hoob

  • Entrant
  • Posts: 1
Re: [TUTORIAL] Resize partitions in a MBR/GPT hybrid setup [TUTORIAL]
« Reply #1 on: August 06, 2010, 10:24:51 PM »
ubuntu 10.04 live-cd offer gparted also in "try mode without installation", why don't you use it ? parted-magic make more ?

make attention to gdisk in ubuntu 10.04 is only 0.5.1.1 and mr Rodd says it's too old. So apt-get install gdisk is bad idea !
use only download link from eyvind tutorial by web link on .deb for newest gdisk release.