• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Formatting a dual boot system (WinXP/Linux)

culex

Senior member
Jul 26, 2000
744
0
76
Too much clutter and disorganization is leading me to format my WinXP partition but I've never formatted my system before when Linux was on it as well.

Currently, the system is being dual booted with LILO. I'm afraid I'll screw up a whole lot of stuff if I were to format with LILO on this thing.

My main goal is to reformat XP partition fresh, but still keep LILO working as it's supposed to.

Question is, will I need to get rid of my Linux installation and LILO first before I format WinXP?

Or is there a painless way to do this?

Thanks.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
If you just format your Windows XP partition that will not affect the Master Boot Record (place were bootloader and partition information is stored at the beginning of your harddrive) or your Linux partition.

However the crappy part is that when you go to reinstall Windows it will overwrite Lilo with it's own NTLDR (windows bootloader) and render the Linux OS unbootable.

it will still be there, it just won't be able to be booted up.

To fix Lilo you need to bootup with a rescue cdrom or disk of sorts.

Some distros, like Fedora, have a rescue disk that can do things like restore the loader.

However if you don't have one of those you can use something like Knoppix to boot up and do it manually.

basicly to fix lilo, you bootup with the rescue disk. Mount your root partition to a directory (say /mnt/harddrive), then you use the "chroot" command.

Chroot changes the root enviroment of your user. Basicly your user switches from one OS enviroment to another so you can run commands as if you were running a different install.

So you go:

mount /dev/whatever /mnt/harddrive (if knoppix didn't already mount it to something else automaticly)
cd /mnt/harddrive
chroot ./

Now your operating in your OS on the harddrive. Then your check your lilo.conf to make sure that is correct and then run the "lilo" command to install the lilo bootloader.

And that should be that. After that you type "exit" and then cd / and then umount everything and reboot and it should work.

Also you'd want to make sure that you know how to restore the Windows bootloader using "recovery mode" on the windows install cdrom incase something goes wrong. That way you don't accidently make both OSes unbootable and get screwed over.

You do that with the "fixmbr" command. (from that page there are links talking about howto use the recovery console).
 

user1234

Banned
Jul 11, 2004
2,428
0
0
If you can't boot a hard drive because the master boot record was overwritten or corrupted, I always boot from a CDROM like Knoppix. It's a live Linux CD, which means you can boot it and all the linux tools are available to you. So you could inspect the hard disk partition table and even modify it with programs like fdisk or qtparted. You can also mount any of the partitions using the Knoppix desktop icons (knoppix makes it really simple), and fix or reinstall your boot loader configuration. So always have a knoppix CD handy.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
oh and if your using grub you'd probably have to mount proc first...

after the chroot
mount -t proc proc /proc
or
mount -t proc proc /mnt/harddrive/proc
before chroot
 

user1234

Banned
Jul 11, 2004
2,428
0
0
Originally posted by: drag
oh and if your using grub you'd probably have to mount proc first...

after the chroot
mount -t proc proc /proc
or
mount -t proc proc /mnt/harddrive/proc
before chroot


To restore grub, can't you just mount the partition containing the grub directory, and do grub-install and give the location of grub directory with the --root-directory option. That should reuse the existing menu.lst in the grub directory.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Originally posted by: user1234
Originally posted by: drag
oh and if your using grub you'd probably have to mount proc first...

after the chroot
mount -t proc proc /proc
or
mount -t proc proc /mnt/harddrive/proc
before chroot


To restore grub, can't you just mount the partition containing the grub directory, and do grub-install and give the location of grub directory with the --root-directory option. That should reuse the existing menu.lst in the grub directory.

When I fix stuff like that I use the chroot command and I haven't had to mess around with that a whole lot.

I suppose it makes a difference though.
 

user1234

Banned
Jul 11, 2004
2,428
0
0

To summarize, after installing windows - to re-install your boot loader for mulitboot, do the following:
- Boot from a Linux live CD, like knoppix
- mount your linux partition (e.g. mount /dev/hda2 /mnt)
- re-install grub (grub-install --root-directory=/mnt /dev/hda)
- add an entry to boot windows in menu.lst (under /mnt/boot/grub), for example
title windows
root /dev/hda1
chainloader +1
boot


btw, even if you had other partitions, use the same procedure above, just mount the partition where the grub config files used to be (and specify the mount directory as the root directory for grub-install, as shown). This is the SOP (standard operating procedure) after installing something (like windows, or a linux installation in a new partition) which overwrites or corrupts your master boot record.