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

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. :expressionless: 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.

correct :slight_smile:

@XTechManiac : All u need to do after XP install is reinstall grub bootloader of Ubuntu :slight_smile: … 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 RecoveringUbuntuAfterInstallingWindows - Community Help Wiki . 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.
$ sudo dd if=mymbr.bak of=/dev/sda1
  1. 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!

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?

So the command will be this??

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.. :face_with_tongue: (Anyways I’ve attached the correct one).
Hmm so my Windows is installed on /dev/sda1 I think.
So command will be:-

Correct me if I am wrong.


Attachments:

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?

Pretty much. The official way is to use the Ubuntu Documentation on re-installing Grub2, which is slightly tedious IMHO.

Thanks all of you. :slight_smile: All of my doubts are cleared.