November 24, 2024, 01:34:58 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Restoring the boot sector  (Read 14657 times)

Offline sashijoseph

  • Linux Noob !
  • *
  • Posts: 14
Restoring the boot sector
« on: September 04, 2004, 01:30:33 AM »
I have win98 and FC1 dual boot.Now I accidently installed grrub in the boot sector of the win98 partition(hda1) instead of the mbr(hda).Of course 98 won't boot.Does grub keep a backup of the sector it is writing?Or is there any other way of restoring the boot sector?

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Restoring the boot sector
« Reply #1 on: September 04, 2004, 05:48:46 AM »
In this case , boot from win98 startup disk and then do "fixmbr" , now again boot to Fedora using installation disk and using linux rescue install grub on MBR . your problem will be solved !

Offline sashijoseph

  • Linux Noob !
  • *
  • Posts: 14
Restoring the boot sector
« Reply #2 on: September 05, 2004, 03:24:20 PM »
Ricky,what I meant was that I accidently wrote to the boot sector of win98 partition INSTEAD of the mbr.So now I actually have the mbr in the 98 boot sector ie I get the grub screen with win and fc1 listed;fc1 boots fine but when I select win98 it executes the boot sector(first sector of 98 partition)and i get the same grub screen back again.Even if I do a fdisk/mbr,the problem remains as it's not the mbr but the 98 boot sector which is at fault.

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Restoring the boot sector
« Reply #3 on: September 05, 2004, 03:38:30 PM »
Well.. if you do fdisk -MBR then it will remove grub !! but you are having grub so you are doing wrong.

In right manner, after fixmbr you will not get grub , you can only boot windws then again write to mbr ie install grub .. then you will be fine.

Offline sashijoseph

  • Linux Noob !
  • *
  • Posts: 14
Restoring the boot sector
« Reply #4 on: September 06, 2004, 05:56:29 PM »
Well Ricky thanks for keeping this thread alive.I don't think there is a 'fixmbr' in win98;there's one in XP though.But even if there was I don't think it would help because it would remove grub from the mbr and only win98 would be left but it wouldn't correct the boot sector of win98 partition.Like I said I accidently wrote grub to the 98 boot sector instead of the mbr.So even if the mbr is corrected by 'fixmbr' it wouldn't help as the job of the mbr is to read the partition table and load the boot sector of the appropriate partition into memory and pass control to it.This boot sector then loads the operating system.But I've lost this boot sector which now contains grub.The mbr and this boot sector are both different things.

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Restoring the boot sector
« Reply #5 on: September 07, 2004, 06:07:18 AM »
win98 does contains..  fdisk -MBR


:)

Wht you need is first restore win98 boot sector so that you can boot 98 then install grub so that you can boot both !!

Offline sashijoseph

  • Linux Noob !
  • *
  • Posts: 14
Restoring the boot sector
« Reply #6 on: September 08, 2004, 05:25:57 PM »
Booted from win98 CD.... fdisk -MBR
"Parameter format not correct  -MBR"
Ricky are you sure it is fdisk -mbr and not fdisk /mbr?
Thanks.

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Restoring the boot sector
« Reply #7 on: September 09, 2004, 04:26:00 AM »
hmm..
yes it is fdisk /mbr sorry for last reply ..

Offline avo

  • New Member
  • Posts: 1
Expert needs to do some homework
« Reply #8 on: September 11, 2004, 08:45:56 PM »
Sashijoseph, I'm recovering from exactly the same problem. No amount of fdisk /mbr can possibly fix this problem. To understand what's broken you have to understand a little about how grub works. Grub installls basically what amounts to a jump table in the MBR. The real work of booting up is done by extracting the OS specific boot info stored at the beginning of a partition. You and I, alas, replaced the Win98 boot block with another copy of grub's mbr (a.k.a. stage1).

The good news is that you can boot up Linux. Linux will let you  mount your Win98 partition. All you files are there!  If you have room save it in a Linux partition. Then you can reformat the windows as a bootable partition, and then (using Linux again) copy all your saved win stuff back into your new win partition.

Lastly, after you've done that you may want to make a copy of your win98 boot block:
dd if=/dev/hda1 of=MBRhda1.bin bs=512 count=1
(Assuming your win partition is hda1)
I believe the file created will be a snapshot of the Win98 boot block. It may help if you ever have to recover your win partition again.

Check out this site for more stuff on grub, mbr, windows, etc.
http://www.geocities.com/thestarman3/asm/mbr/GRUB.htm

Offline sashijoseph

  • Linux Noob !
  • *
  • Posts: 14
Restoring the boot sector
« Reply #9 on: September 12, 2004, 03:31:05 AM »
Yeah thanks Avo for the tip. :D

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
Re: Expert needs to do some homework
« Reply #10 on: September 12, 2004, 05:27:48 AM »
Quote from: "avo"
Sashijoseph, I'm recovering from exactly the same problem. No amount of fdisk /mbr can possibly fix this problem. To understand what's broken you have to understand a little about how grub works. Grub installls basically what amounts to a jump table in the MBR. The real work of booting up is done by extracting the OS specific boot info stored at the beginning of a partition. You and I, alas, replaced the Win98 boot block with another copy of grub's mbr (a.k.a. stage1).

The good news is that you can boot up Linux. Linux will let you  mount your Win98 partition. All you files are there!  If you have room save it in a Linux partition. Then you can reformat the windows as a bootable partition, and then (using Linux again) copy all your saved win stuff back into your new win partition.

Lastly, after you've done that you may want to make a copy of your win98 boot block:
dd if=/dev/hda1 of=MBRhda1.bin bs=512 count=1
(Assuming your win partition is hda1)
I believe the file created will be a snapshot of the Win98 boot block. It may help if you ever have to recover your win partition again.

Check out this site for more stuff on grub, mbr, windows, etc.
http://www.geocities.com/thestarman3/asm/mbr/GRUB.htm


Hmm..
I had been same problem once.. I copied win98 boot sector and then installed grub and pointed it to load win98 !
anyway.. wht we all need is solution .. one or another way !