Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to stop Windows changing disk table 3

Status
Not open for further replies.

roycrom

Programmer
Aug 2, 2002
184
0
0
GB
I have windows XP SP2 and gentoo linux on the same hard drive.

Windows on first partion (hda1)
Gentoo /boot (hda2)
Gentoo swap (hda3)
Gentoo / (hda4).

Using fdisk I toggle the bootable partition to point to hda2 , so I get the choice of which OS to boot from grub on hda2.

This works fine if I load gentoo, however if I load windows then the next time I reboot, the system just goes straight back to windows(i.e. straight to hda1 instead of hda2), and if i check with fdisk, it seems windows has changed which partition to boot from, back to hda1.

Does anyone know how I can stop windows from writing that info back to the disk table so it ALWAYS looks at hda2 first regardless of which OS was previously booted.

Many thanks if you can help me, I am getting fed up of having to boot from liveCD everytime I want to revert to the linux boot.

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
Silly question but does your BIOS have a boot sector protect mode? (Antivirus mode).
I'm not sure but that might be worth a try.



Trojan.
 
You have the boot loader (grub in this case) installed on the first track of the bootable drive. You want to install it in MBR.
 
Thanks for the replies guys.

RhythmAce, if I install grub to the MBR, will that not interfere with the way that windows boots up? I have no easy way to test this and dont want to be ruin my windows install, although it would not be a COMPLETE disaster as I have NTFS support on the linux OS which allows me to mount the windows partition from there.

I used the command
Code:
grub> boot (hd0,1)
grub> setup (hd0,1)

If I use the command
Code:
grub> boot (hd0,0)
grub> setup (hd0,0)
will this not overwrite the info that windows needs to boot up from? This is my first attempt at a dual boot, and although I understand the basics, I have read a lot of poosts on various forums about people doing something similar and it ended up screwing their windows install.

If you can't help further thanks for the original replies.

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
Windows likes to do things like overwrite the mbr. This is why on all dual boot installations they have you install windows first. Then you install linux. Before the install is complete you are asked which boot loader you want, lilo or grub. Grub seems to be thew loader of choice these days and some linux distros don't even pack lilo any more. Any hooo - install grub on the mbr. You can use the grub shell as you suggested or use grub-install. Grup is perfectly capable of loading almost any os out there. Just in case I'm talking out of my butt, you may want to make a boot disk. :)

 
I've always used lilo, and always insalled on the hdd mbr. I've never had a problem. I assume it's the same with grub.

Mark
 
Can I just make sure that I have this correct with regards to the MBR, all that this contains is the Partition table and which partition to look in first to find the boot loader?

I say this because I use grub to tell the MBR to look in 2nd partition for grub. Then when i boot I use grub to select OS.

If I select linux then next time I boot, I get grub again, if I choose windows next time I boot it just boots straight to windows.

I just need to stop windows overwriting MBR to prevent it from booting from 1st partition. I've looked in boot.ini but dont believe there is a switch for this.

I've tried turning on virus protection in BIOS, windows then wont boot unless i let it write.

I believe I am gonna have to end up using the NT loader to choose which OS, although I have no floppy drive which is gonna make this tougher for me [sadeyes]

Thanks for all your help guys, it is really appreciated

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
Could it be something in SP2? I have never had that issue. Of course, I quit using M$ before Xp was even born. (Lucky for me he-he-he).

Mark
 
Well I ended up corrupted my windows partition, so I decided to give windwos 64 a go. Unfortunately, my webcam, usb modem and printer wouldn't work. Nice of them to release an OS with virtually no hardware support!! So I ended up having to go back and spend hours downloading all the updates from my SP1 disk. If I had seen your post earlier I would have tried with XP SP1 to see if the same thing happened there with regards to the boot situation.

I too would also ditch M$, if only decent ports of games were available, and gaim would receive AND broadcast webcam [ponder].

Apart from that I don't really need windows.

I think I'm going to be going down the Windows route to choose my OS. I'll post here to say how I get on, as I'll try this when I get home from work. As long as I can get my sata to mount read write [purpleface]

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
I just installed Fedora 4 on a clean system with WinXP Pro SP2, and another two with XP home and FC3 on already. grub works perfectly (although I always use the Fedora installer to set it up) but I seem to remember that there's some chain loading that needs to go on with Windows. If you've set it up manually you may have missed out on this?

I'm not at home at the mo, so I can't post my grub config file. Maybe someone else has a dual boot file thay can post?
 
# on /dev/hda1
title Microsoft Windows XP Professional
root (hd0,0)
savedefault
makeactive
chainloader +1


Chacal, Inc.
 
Code:
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,4)
#          kernel /vmlinuz-version ro root=/dev/hda7
#          initrd /initrd-version.img
#boot=/dev/hda
default=3
timeout=10
splashimage=(hd0,4)/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.12-1.1390_FC4)
	root (hd0,4)
	kernel /vmlinuz-2.6.12-1.1390_FC4 ro root=LABEL=/1 rhgb quiet
	initrd /initrd-2.6.12-1.1390_FC4.img
title Fedora Core (2.6.12-1.1387_FC4)
	root (hd0,4)
	kernel /vmlinuz-2.6.12-1.1387_FC4 ro root=LABEL=/1 rhgb quiet
	initrd /initrd-2.6.12-1.1387_FC4.img
title Fedora Core (2.6.11-1.1369_FC4)
	root (hd0,4)
	kernel /vmlinuz-2.6.11-1.1369_FC4 ro root=LABEL=/1 rhgb quiet
	initrd /initrd-2.6.11-1.1369_FC4.img
title Windows XP (SP2)
	rootnoverify (hd0,0)
	chainloader +1
 
Thanks for these posts guys,

A couple of questions (as if you didn't expect it).

Chacalinc, you have a savedefault and makeactive specified in your windows section. Why don't you have these in yours stevexff?

Also, what is the difference between root and rootnoverify?

When you installed grub, did you use
Code:
grub-install
or
grub>root (hd0,4)
grub>setup (hd0,4)
and did you use fdisk(or equivilent) to put the bootable partition to /dev/hda5? (/dev/hda5 being same as hd(0,4) ihope)

Thanks again everyone.

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
just for info, I think this is how my windows section is set up. I say think because I'm not home, but am pretty sure this is it.
Code:
title Windows
rootnoverify (hd0,0)
makeactive
chainloader  +1

Thanks

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
what is the difference between root and rootnoverify?


you have a savedefault and makeactive specified in your windows section

When you installed grub, did you use

[tt]grub-install /dev/hda[/tt]

Cheers.

Chacal, Inc.
 
Well this message has had a lot of mileage and I really appreciate all the help, I've got it sorted now thanks [2thumbsup]
It was just a case of taking the makeactive out of my windows section.
It seems obvious now, but at the time I thought it was windows doing it, whereas grub was altering the partition table to make the windows partition the bootable one because of the 'makeactive'.

This is my interpretation anyway :)

Code:
title Windows
rootnoverify (hd0,0)
chainloader  +1
This is my final windows section, just removing that line would have saved me two windows installs, but I guess its best to learn the hardway. Thanks again for all your help.

------------------------------------------
Somethings come from nothing, nothing seems to come from somethings - SFA - Guerilla

roycrom :)
 
From a PC with just windows on it, I defragged the partition first, then used PartitionMagic to resize it smaller and set up the linux partitions in a logical partition.
Code:
Windows 
logical
   /boot
   swap
   /
then just opted for manual partitioning during install and mapped them accordingly from disk druid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top