LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Re-installing XP on dual boot system (http://www.linuxquestions.org/questions/linux-newbie-8/re-installing-xp-on-dual-boot-system-563714/)

aktar 06-22-2007 10:00 AM

Re-installing XP on dual boot system
 
I originally had Xp alone but later installed Debian as a dual boot. Now I have Xp in /dev/sda1 and Debian on /dev/sda7.
When I installed debian, I chose to install the grub in the Xp drive.

But now I need to re-install xp because of those bloody viruses AGAIN:mad: (what a suprise)

If I format /dev/sda1 (c:\) then I loose GRUB, and everything collapses.

WHAT DO I DO???

deroB 06-22-2007 10:09 AM

If you don't have one already...get yourself a live-cd and reinstall grub after installing windows.

see here for tips on installing grub:
http://ubuntuforums.org/showthread.php?t=224351

aktar 06-22-2007 10:30 AM

Quote:

Originally Posted by deroB
If you don't have one already...get yourself a live-cd and reinstall grub after installing windows.

see here for tips on installing grub:
http://ubuntuforums.org/showthread.php?t=224351


Can I not just move the grub to the debian partition first and format the xp drive?

saikee 06-22-2007 10:35 AM

Any Live CD can restore Grub at any time.

If it has Grub then you can activate the Grub shell in a root console and tell Grub to get back to the MBR using Debian from sda7 or (hd0,6) to Grub by commands
Code:

grub
root (hd0,6)
setup (hd0)
quit
reboot

If the Live CD has no Grub support so you can activate a Grub shell you can still restore Grub by its kernel. Again in root terminal
Code:

mkdir /mnt/sda7
mount /dev/sda7 /mnt/sda7
chroot /mnt/sda7
grub-install /dev/sda
exit
reboot

The last one can be done on any Live CD even without the Grub support. The reason is you boot up any Linux kernel (from a Live CD) but change root to Debian. You therefore issue the grub-install command inside its Bash shell. It is a sure-fire universal method and the one to remember if you ever wish to restore grub or Lilo.

When you install XP its installer overwrites the MBR and destroys Grub's stage1 file there. The restoration of Grub is to put its stage1 back into the MBR. All the necessary files are already inside the Debian partition. The command "root" + "setup" in a Grub shell or "grub-install" in Bash shell will make the necessary connection.

aktar 06-23-2007 09:56 AM

Problem sorted
 
Thanks guys, great help.
Problem sorted

ok4life 07-26-2007 04:16 PM

I found this thread when I was preparing my laptop for XP repair install, dual booting Suse SLED 10.0/XP Pro SP2. I ran the repair with a SP2 OEM CD and it never wiped my MBR? I was kinda confused due to that GRUB is the loader hda1 is XP hda6 is / and hda7 is /home with the MBR being on hda1. seemed kinda odd to me but just thought I'd throw it our there for others.

saikee 07-26-2007 04:57 PM

Nothing odd about that.

Grub can be installed with a Linux or without a Linux. It can boot from any logical or primary partition that Grub can read.

You can put Grub in a data-only primary and use XP to boot up Grub.

You can use Grub from a Solaris to boot Linux or Windows. The choice is endless.

If your XP installation CD did not wipe Grub then you have not succesfully restored XP's MBR.

futoskope 09-12-2008 07:32 AM

Re Installing XP on a dual boot system
 
I m also facing the similar kind of problem...but i did one more mistake...Initially I had Windows XP(SP2) and Scientific Linux 5.1 in my dual boot system...and the default bootloader was grub. Now due to some virus problem I am forced to fomat the NTFS partition where previously windows were and re-installed XP on the same existing partition. I didn't touched any other partition during installation. But I forgot to note down the partition where linux is installed. I have the bootable XP cd and one ubuntu live cd. Is it possible to bring back the previous dual boot state(i mean the boot screen where it prompts for linux or windows..and so on...)without effecting the existing linux in the system? Please refer the solution along with the code also.Please tell me how to see the existing linux partition and where to install grub.

thanks and regards.

yancek 09-12-2008 08:58 AM

Use the Ubuntu Live CD, open a terminal and enter: sudo fdisk -l, this should output your partition information and show you where your Linux version is installed.


All times are GMT -5. The time now is 11:22 PM.