I want to change the MBR to my internal Hard Disk to boot the XP from there

Asked by Mathew P George

Hi,

I've up graded to Ubuntu 10.04 recently, while installing the new version the MBR has been changed to External Hard Disk (I use internal Hard Disk for the official purpose (OS-XP) only). I've installed Ubuntu in the External Hard Disk and since the MBR has been changed to External I'm not able to load my XP which has been installed to the Internal HD. I've changed the MBR to Internal HD using command in the terminal (sudo ms-sys --mbr /dev/). Even after changing the boot record to Internal HD I couldn't load XP it came with an error message unable to load the OS.

Could some one help me in identifying how to rectify this bug and come out with a permanent solution where in I should be able to login to XP as usual and choose External HD to load the Ubutnu OS

Cheers !!

Mathew

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu firefox Edit question
Assignee:
No assignee Edit question
Solved by:
delance
Solved:
Last query:
Last reply:
Revision history for this message
delance (olivier-delance) said :
#1

http://blogs.deepal.org/2009/06/how-to-fix-mbr-using-ubuntu-live-cd.html
As you have Ubuntu installed, you don't need Live CD.

After :

https://help.ubuntu.com/community/Grub2#Reinstalling%20GRUB%202

If you need some help, post results of commands
   sudo parted -l

Revision history for this message
Daniel (djr1215) said :
#2

I have a similar problem in that after re-installing grub in Ubuntu 9.10 on /dev/sda (Windows XP hard drive), I'm unable to boot into Windows. I tried using the Windows XP cd to repair the mbr but the cd just hangs up. Also tried restoring Windows MBR using "sudo install-mbr" which also didn't work. I found a reference to "install ms-sys" which is supposed to write Microsoft compatible boot records but I couldn't find this app. It's not listed in the Synaptic Package Manager. I have Ubuntu 9.10 installed on a second hard drive. Does anyone have a solution to this problem? I want to restore the Windows MBR without having to completely re-install Windows.

Revision history for this message
Mathew P George (mathewpadinjath) said :
#3

Thank you so much Delance ...... and sorry for not replying on time.

The following are the hard disks connected to my pc

mathew@mathew-laptop:~$ sudo parted -l
Model: ATA FUJITSU MHV2060A (scsi)
Disk /dev/sda: 60.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 60.0GB 60.0GB primary boot

Model: Seagate FreeAgent Go (scsi)
Disk /dev/sdb: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 283GB 283GB primary ntfs
 2 283GB 294GB 10.7GB primary ext4 boot
 3 294GB 295GB 1078MB primary linux-swap(v1)
 4 295GB 320GB 25.1GB primary ext4

mathew@mathew-laptop:

I want the system to boot from sda (internal HD where I've installed XP) as usual without doing anything; and choose external HD by clicking F12 while turning on the system to login to Ubuntu.

I've been working good with the earlier version, ever since I've installed Ubuntu 10.04 version, I'm having this problem. I changed the MBR to sda but when I've updated the changes using update manager the MBR has been changed again and I am not able to login to XP there after. (even If I choose internal hard disk to boot from, it givem me an error operating system can not be found

Please help me out with some permanent solutions so that I need not go back to my IT guys everytime telling that XP got corrupted :)

Cheers

Revision history for this message
delance (olivier-delance) said :
#4

Daniel, your problem is really not similar. I opened a question for you, and also post start of an answer.
https://answers.launchpad.net/ubuntu/+question/111624

Revision history for this message
delance (olivier-delance) said :
#5

Command to restore MBR should be (XP in first drive)
        sudo ms-sys -m /dev/sda
-----------------------------------------------------------------------------------
Internal Hard Disk Disk /dev/sda: 60.0GB OS-XP
 1 32.3kB 60.0GB 60.0GB primary boot

External Hard Disk Disk /dev/sdb: 320GB Ubuntu 10.04
 1 ntfs
 2 ext4 boot => /
 3 swap
 4 ext4 => /home ??

It is a very unusual configuration! First time I see usage of an external disk.
If you reinstall Ubuntu, Ubuntu will reinstall Grub on first sector of first drive.
And Grub will search configuration file (including to load XP) on /boot on second disk.
So if you remove external disk, you can't use Ubuntu neither XP!

A solution can be to define in BIOS the external USB disk at first disk at boot, and internal XP disk as second.
So:
 1) if you plug external disk
     Ubuntu is installed in first disk, and can chain to MBR of second disk
 2) if you don't plug external disk
      internal disk is first disk and MBR of XP is happy!

You must firstly reinstall XP (else later Ubuntu will never detect this OD)
You have two solutions

 1) if you don't plug external disk
Insert XP CD and do a
           FDISK.EXE /MBR
  2) if you plug external disk
Boot under Ubuntu and do (if XP is first disk, i.e. on /dev/sda)
      sudo ms-sys -m /dev/sda

After you have to plug external disk, and do, under Ubuntu (Ubuntu disk is first disk, i.e. on /dev/sda):
        sudo grub-install /dev/sda

Revision history for this message
Mathew P George (mathewpadinjath) said :
#6

Hi Delance,

I did the same some time back (sudo ms-sys -m dev/sda) and re installed XP it worked perfectly for few days until " I used the update manager." There goes...... XP is vanished and it gave me an grub error message while I switch on the system. I changed the MBR to sda but XP didn't load gave me a message operating system can not be found.....

Also is there any tool to back up and restore the MBR.

So what I understand is that MBR gets changed every time I use the update manager (it never happened to me while I was using previous version of Ubuntu) and that force me to re-install XP

Thanks in advance ..

Revision history for this message
Best delance (olivier-delance) said :
#7

Hi Mathew.
First step is to restore XP, else Grub2 will be unable to see it.
So unplug external disk to have only XP disk on computer.
If you have a XP CD, boot on it and do:
    FDISK.EXE /MBR
And check after you boot directly on XP, after we can see Ubuntu boot.

Revision history for this message
Mathew P George (mathewpadinjath) said :
#8

Thanks delance, that solved my question.

Revision history for this message
Mathew P George (mathewpadinjath) said :
#9

I'm going to re install XP now ....

and once again thank you so much Delance for ur support ...

cheers

Revision history for this message
Tom (tom6) said :
#10

Hi :)

I think Delance was saying restore rather than a full re-install! The Windows Cd should give you a "repair" option which usually allows people to fix the Windows boot-loader and Mbr. Then just re-fix the Ubuntu one and it should all work well this time around.

Of course a full re-install of Windows will make Windows work very much faster for a few months before the usual slow-downs kick-in. I have heard some hard-core gamers reinstall Windows every month! (But i guess they don't install many other programs, just the games.)

If you have done a full re-install and now need Office programs and an email client then OpenOffice & Thunderbird are free on Windows too :)
I hope this helps!
Good luck and regards from
Tom :)