# MBR/GPT issue continued



## rhish (Nov 24, 2012)

My solution failed, so I thought I would start a new thread.

I have a 120GB disk which has been used for many many installs of windows, BSD, Linux over the years. I was attempting to get WinXP and FBSD9 dual boot installed and failed. So I decided to wipe and start over. But im running into the same problem.

Windows uses the MBR. FBSD wants to use GPT. But GPT isn't recognizing the Windows install in the MBR. The Windows install doesn't show up in the partition scheme tool during install.

Originally the Primary GPT was corrupt, and it was reverting to Secondary. Which, I believed was the issue. So I ran

[cmd=]# gpart recover ada0[/cmd]

This worked, and gpart no longer shows 
	
	



```
[CORRUPT]
```
 But the Windows partition information is still absent.

Imagine you have a Laptop with 120GB HD. You have no idea whats been installed, partitioned, whatever. You need to get WindowsXP and FBSD up and running dual boot. What would the process be, if you do not care about anything currently on the drive, to restore its mbr, gpt, to a factory default type state, and get WinXP/FBSD dual bootable?

I just tried re-installing WindowsXP, and then FBSD9, but ran into exact same issue. Once I get to the partition scheme in the install, the Windows partition is not present. I dont remember it being this difficult to get FBSD installed AFTER a WindowsXP install. 

Side question, lets say I have a FBSD9 cd. I boot into the installer, and then drop to SHELL. I can then run sysinstall and get the old style partition/label tools to setup an install. Is it ok to do so? Is it improper? Will it even work? Could I do this just for partition setup, or could I perform the entire install through sysinstall old style setup?


----------



## wblock@ (Nov 24, 2012)

In case you have not seen me say this before, dual-booting makes life more complicated and is usually not necessary.  Pick one OS to support the hardware and run everything else as a VM.  But few people pay attention to that, so let's continue on with this excursion.

Windows XP only supports MBR, so the disk must be MBR partitioned.

recover was the wrong option.  That copied the backup GPT to the primary GPT.  Now you have a GPT-only disk.  So one problem solved, but not the one that needed to be solved.

Back up anything you want to save.  Then boot FreeBSD or mfsBSD and wipe out the GPT.
`# gpart destroy -F ada0`
Ignore errors, if it shows any.
`# gpart create -s gpt ada0`
`# gpart destroy -F ada0`

Now that disk has no partition information.  Install XP, partitioning it and leaving room for FreeBSD.
After that hours-long ordeal, back up the XP system.
Install FreeBSD.  The installer will see that the disk is MBR and an automatic install should use the unpartitioned space.
At the end of the install, go to the shell and install boot0cfg(8).  See the man page, but I think this will do it:
`# boot0cfg -B ada0`


----------



## rhish (Nov 24, 2012)

I completely understand your suggestions for getting away from dual booting. This particular Laptop Toshiba 5105-s501 dos not have a standard BIOS interface. In fact, there is NO WAY of interfacing the BIOS except for from within Windows using Toshiba's BIOS software. Which means, if I ever want to interface the BIOS, change boot options to boot a CD, or whatever, I have to have Windows installed to do so. 

If it werent for this one issue, i would have dropped Windows XP on this laptop long ago. I use Oracle VM Virtualbox often and enjoy doing things that way. Unfortunately, it does not allow for the BIOS interface, from within a WinXP VM.


----------



## wblock@ (Nov 24, 2012)

So keep XP as the native OS and install FreeBSD as a VM.  You can even use GPT on the VM drive.


----------



## rhish (Nov 24, 2012)

Concerning the [cmd=]RECOVER[/cmd] versus [cmd=]RESTORE[/cmd]. I was unsure about that. In the MAN page it shows 'restore' as being the option for restoring the primary using the 'backup'. I assumed this meant using the secondary to restore the primary. 
But the restore is for something unrelated to the secondary? It restores a 'backup' I would have needed to create beforehand?


----------



## rhish (Nov 24, 2012)

The gpart destroy is where Im at now. I did have the errors initially, but then -F let me do it anyways.

Lets say I destroy the GPT, recreate it. Its now default. If I then reboot into the Windows recovery and do FIXMBR, it should ensure the MBR is proper. 
If i then boot the FBSD9 install, it should see the MBR information and know about the windows xp partition.

After destroying the GPT, the installer still doesn't see the Windows MBR partition information.

I'm going to start all over and run the entire process again. Destroy, create, destroy the GPT. Reboot, install windows XP. then boot into FBSD9 and check to see if it sees the Windows MBR partition. 

thanks for your patience and advice.


----------



## rhish (Nov 24, 2012)

Side question - are there any programs available when I drop to shell, that can display/interact with the mbr, the same way gpart does GPT? What would be the proper one to use? I can research all the details.
thanks again


----------



## kpa (Nov 24, 2012)

No, do not recreate the GPT, that seems to be the biggest misunderstanding here. Windows XP can not be installed on a GPT partitioned disk, it has to be MBR. Destroy the GPT and create a MBR partition table using Window's own partitioning tools.


----------



## rhish (Nov 24, 2012)

When I do 

[cmd=]#fdisk[/cmd]


```
fdisk: mounted root fs resource doesn't match expectations (regexec returned 1)
```


----------



## rhish (Nov 24, 2012)

kpa, yes, this is what Im doing. I think the create was just to sort of setup a proper delete.

Destroying the GPT, recreating it, and destroying it again.

But, even after doing this, the FBSD9 installer isn't seeing the windows partition.

So, I've destroyed the GPT. Reboot and have windows XP installed. FBSD installer shows a blank empty disk still. For whatever reason, the FBSD installer partition tool isn't seeing the MBR at all. I think maybe It is corrupt? Or its in a state where Windows can read enough of it and load, but the FBSD installer isn't reading it enough to show the partition.


----------



## wblock@ (Nov 24, 2012)

rhish said:
			
		

> Concerning the [cmd=]RECOVER[/cmd] versus [cmd=]RESTORE[/cmd]. I was unsure about that. In the MAN page it shows 'restore' as being the option for restoring the primary using the 'backup'. I assumed this meant using the secondary to restore the primary.
> But the restore is for something unrelated to the secondary? It restores a 'backup' I would have needed to create beforehand?



Yes, it restores a backup created with gpart backup.


----------



## wblock@ (Nov 24, 2012)

kpa said:
			
		

> No, do not recreate the GPT, that seems to be the biggest misunderstanding here. Windows XP can not be installed on a GPT partitioned disk, it has to be MBR. Destroy the GPT and create a MBR partition table using Window's own partitioning tools.



If you're looking at post #2, it creates a GPT scheme and then destroys it just to make sure the secondary GPT is destroyed.


----------



## rhish (Nov 24, 2012)

Success!

The FBSD installer now sees the Windows partition. 
I think the create, destroy worked. That added little step to ensure both tables get wiped congruently seemed to make the difference.

Once I get FBSD installed ill throw the boot0cfg and be back in business.

thanks!


----------



## rhish (Nov 25, 2012)

Everything worked!

There was a weird bug when I did my first reboot. The bootmgr came up
F1 Win
F2 FreeBSD

F6 PXE Boot #

with the "#" and the prompt was right after it, any button I pushed started adding more #'s

#######

So I did a hard reboot and everything is normal, seems to be working correctly.

Thanks for the help WBlock


----------

