Have to format XP(dual boot with Ubuntu) -- some queries

XTechManiac

Level E
Hi TEians,

I've dual boot Windows XP and Ubuntu 10.04 Lucid Lynx on my pc.
For some reason I've to format my Windows XP. I have some queries:-
I've first installed XP and then Ubuntu. And as I said I will have to format my Windows XP due to some reason. :| After formatting/installing a fresh copy of XP will I be able to boot in Ubuntu? I mean will the option of selecting OS will be shown during booting time(as it show now) after my XP is formatted? Or I've to edit some boot file in order to show it? If so, please guide me through the process. Oh btw I am a Linux n00b. Just started using if past 1 month. So if possible please guide me step by step.

Thanks in advance.
 
after installing XP, you will not get the option of booting into linux. XP will overwrite with its own bootmanager. in linux, you have an option of taking a back-up of your bootmanager and then boot from that back-up. this is all i know. google on this for more or wait till some experts reply.
 
Malique said:
after installing XP, you will not get the option of booting into linux. XP will overwrite with its own bootmanager. in linux, you have an option of taking a back-up of your bootmanager and then boot from that back-up. this is all i know. google on this for more or wait till some experts reply.
correct :)

@XTechManiac : All u need to do after XP install is reinstall grub bootloader of Ubuntu :) ... just read carefully before executing commands

Reinstall Ubuntu Grub Bootloader After Windows Wipes it Out - How-To Geek
 
After re-installing XP you'll not get the GRUB Bootloader, your PC will directly boot into XP, reason is same as said by Malique. After re-installing XP boot using the Ubuntu Live CD and then go to terminal and enter : sudo apt-get install grub2 and sudo update-grub2. This way your GRUB will get installed and updated and everything will restore as it is now.
 
I'm assuming that WinXP will be installed in the exact same way that it was before (i.e. same partition etc). There are a number of ways to reinstall GRUB (the bootloader) after Windows wipes it out. These instructions are quite good https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows . You can also try a slightly weird approach. The only thing that Windows does is overwrite the MBR. You can back it up before you install windows like this:

**DANGEROUS, BE CAREFUL **

1. Figure out the name of your boot hard disk (should either be sda or sdb). I'm assuming that the MBR is on sda1. From Linux, open up a terminal and type this to backup your MBR.

Code:
sudo dd if=/dev/sda1 of=mymbr.bak bs=512 count=1

You should now have a file called mymbr.bak in your current directory, which is a copy of your Master Boot Record. Save this file on a USB stick.

2. Install Windows as usual, let it wipe the MBR (Remember you shouldn't have made any partition changes!!)

3. Boot from the Ubuntu Live CD, plug in the USB with the backed up MBR, switch to the directory that has the file mymbr.bak and run this from the terminal

Code:
$ sudo dd if=mymbr.bak of=/dev/sda1

4. Reboot without the Ubuntu CD, you should have your old familiar boot menu back

Remember this is a slightly risky way of doing it, you could accidentally wipe out your HDDs, so proceed at your own risk. All the best!
 
krishnandu said:
After re-installing XP you'll not get the GRUB Bootloader, your PC will directly boot into XP, reason is same as said by Malique. After re-installing XP boot using the Ubuntu Live CD and then go to terminal and enter : sudo apt-get install grub2 and sudo update-grub2. This way your GRUB will get installed and updated and everything will restore as it is now.
Thanks. I'll try this method first, as it seems quite simple.
viridian said:
1. Figure out the name of your boot hard disk (should either be sda or sdb). I'm assuming that the MBR is on sda1. From Linux, open up a terminal and type this to backup your MBR.
How to figure out name of boot hard disk in ubuntu? Is my boot hard disk dev/sd6?


So the command will be this??
sudo dd if=/dev/sda6 of=mymbr.bak bs=512 count=1
 
XTechManiac said:
Thanks. I'll try this method first, as it seems quite simple.

How to figure out name of boot hard disk in ubuntu? Is my boot hard disk dev/sd6?


Sorry I can't access that image, work blocks such sites :). I've never tried krishnadu's method but I'm not sure if it would work. Anyway, to answer your question your drives probably looks like this:

1. /dev/sda == this means that this is the first HDD detected by Ubuntu. As you mentioned /dev/sda6 is probably where the /boot partition is.

2. /dev/sda1 == is the the first partition and probably has Windows installed on it. So you'd want to go with /dev/sda1
 
viridian said:
Sorry I can't access that image, work blocks such sites :). I've never tried krishnadu's method but I'm not sure if it would work. Anyway, to answer your question your drives probably looks like this:
1. /dev/sda == this means that this is the first HDD detected by Ubuntu. As you mentioned /dev/sda6 is probably where the /boot partition is.
2. /dev/sda1 == is the the first partition and probably has Windows installed on it. So you'd want to go with /dev/sda1
In that image I forgot to mount my partition on which Windows is installed.. :P (Anyways I've attached the correct one).
Hmm so my Windows is installed on /dev/sda1 I think.
So command will be:-
sudo dd if=/dev/sda1 of=mymbr.bak bs=512 count=1
Correct me if I am wrong.
 

Attachments

  • Drives.jpg
    Drives.jpg
    85.2 KB · Views: 114
Yep that should do it! Now save the file somewhere and restore it after windows install with an ubuntu live cd. Just to be sure though, back up your data!
 
Thanks alot all of you.

BTW the process to reinstall ubuntu grub bootloader remains same even if I had installed Ubuntu first and then Windows XP.. and then formatted XP?
 
Back
Top