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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I recover my MBR? 1

Status
Not open for further replies.

Swamphen

Programmer
Jul 17, 2001
84
IT
I was given the advice to overwrite the MBR with LILO or GRUB, while installing Debian next to Win2kPro, because LILO would then automatically present you with a OS-choice at the beginning of the boot-process.

But apparently this doesn't happen. It always boots Debian directly. And since I did a very minimal installment (because I was baffled with the packagenames, I didn't know the IP's to be given in and most importantly I thought I could do all this later after having fetched a decent manual via Win2k), I'm stuck with a Debian without internet access and practically no funtionality whatsoever.

Booting to Caldera Dos and using partinfo.exe of Powerquest Partition Magic I saw that my original partitions where all still there. That is (approximately):
dev/hda1: NTFS 2,5 Gb
dev/hda3: Linux ext2 2,5 Gb
dev/hda5: NTFS 9 Gb
dev/hda7: Linux Swap: 2 Gb
dev/hda9: FAT32: 4 Gb

Using ptedit.exe of PQ Partition Magic you can change some properties of the bootsectors of the different partitions, but I wisely didn't touch that.

I also tried to enter the BIOS setup, but this didn't work.

So, 2 questions:

1) How can I use Win2kPro again (some changes in lilo.conf probably?)?
2) When I again start to install Debian (I'm not planning on giving up), how should I make clear I should use DHCP?

Thanks a thousand times,
Swamphen

 
Your Question No. 1:
If You have installed lilo there is an configuration file /etc/lilo.conf
You'll find something like
timeout = ?
Here You can tell lilo to wait for input. Attention it's in 1/10 seconds. If You write timeout = 80 lilo will wait for 8 seconds.
 
To use DHCP, edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file. Change the line that says BOOTPROTO=static to BOOTPROTO=DHCP.

To obtain or renew a DHCP lease...

dhcpcd -B eth0

To release a lease...

dhcpcd -k eth0

ChrisP If someone resolves an issue for you, or was helpful, please click the link on the bottom left hand corner of their post to give them a "star" letting them know they helped you.
 
the debian installer is pretty dumb when looking out for other OS's. you'll most likely have to add an entry for win2k.

if u look at the bottom of the lilo.conf file you'll see an example for booting HURD. pulling some bits from this you'll want the additional lines of...

other=/dev/hda1
label=Win2k

and you may want to edit the 'default=' line so win2k normally boots. then run lilo again.

as for dhcp you need to edit your /etc/network/interfaces - for dhcp on eth0 you should replace your static settings with...

auto eth0
iface eth0 inet dhcp
 
Langeneck: I already tried that, but this wasn't the problem. Since he actually didn't detect the Win2k-OS during the installment (~ MrTom), he just waited a bit longer before running the default OS, Linux.

Fluid11: Thank you. I will try this options, as well as the solution provided by MrTom.

MrTom: I already tried adding

other=/dev/hda1
label=win2k


And after re-running lilo he gave an error stating there was something wrong with my partition table.

Again, if I run partinfo.exe of PQ Partition Magic, the partitions seem to be ok.

I will try the dhcp-info tonight (I'm at work now)

Thanks,
Swamphen



I'm back at work now, so I will only be able to check all this tonight.
 
If your using PartitionMagic, you also have the option of using BootMagic instead of LILO or GRUB. BootMagic comes with PartitionMagic.

I'm not saying BootMagic is better than LILO or GRUB, its just an alternative if you want to try something different.

ChrisP If someone resolves an issue for you, or was helpful, please click the link on the bottom left hand corner of their post to give them a "star" letting them know they helped you.
 
I have a problem where the bootloader doesn't work. Can anyone visiting help?

I have two separate drives for W98SE and Mandrake Linux so I don't need a bootloader which gives me any options. I just need to boot Linux. At present it just says 'First Stage' and then stops.

Leon.
 
Fluid11: I'm afraid I have to get Win2k up and running before I can install bootmagic.

I again recall the type of the error given after changing lilo.conf. It was something like:

"Invalid Partition Table, nth Entry
3D-address: X-Y-Z(...)
Linear adddress: XYZ'(...)"

Should I run lilo with the -l,-L or -P {fix|ignore}-switch?

Thanks,
Swamphen
 
Try reinstalling LILO. Just type lilo at the command prompt.

ChrisP If someone resolves an issue for you, or was helpful, please click the link on the bottom left hand corner of their post to give them a "star" letting them know they helped you.
 
That's what I did when I got the error: I changed the lilo.conf and reran lilo and then this geometry error was shown.

Swamphen
 
Try running it with the fix switch. It can't make it any worse:) If someone resolves an issue for you, or was helpful, please click the link on the bottom left hand corner of their post to give them a "star" letting them know they helped you.
 
In a moment of heroism, I already tried that and it gave as output something like:

"table rewritten
Fatal: Couldn't retrieve magic number of /dev/hda1"

So, it didn't help and maybe it even got worse.

I tried to reinstall Win2000 over the primary partition, but I couldn't boot from CDRom and I couldn't get into the BIOS to change the boot-ordering.

Right now I have lent another hard drive with Win98 and I'm using that drive as a master drive. My drive is used as a slave driver. I was hoping to retrieve my data in some way, but at the moment I can't even read from the slave drive. Probably that as well requires some changes in the BIOS? And I still can't enter the BIOS setup program. Can this be helped?

Thanks a lot already (I will not forget to reach out some stars at the end).

Swamphen
 
fdisk the master boot record and try reinstalling LILO again.

fdisk /mbr
/sbin/lilo

Why can't you get into the BIOS? Its usually either the Del, Esc, or F1 key. Press them all when the computer starts.

ChrisP If someone resolves an issue for you, or was helpful, please click the link on the bottom left hand corner of their post to give them a "star" letting them know they helped you.
 
1) Your disbelief of my BIOS failure made me try even harder
to press on the Delete button (which is proposed while booting) and this worked. I just hadn't pressed it long enough or at the right time. Silly, really. But thanks a lot
for being sceptical!

2) If you mean that I should use the fdisk of MS-DOS or Win98:

I already tried that and he gave an error, stating that
he couldn't write the MBR to disk.

Or do you mean I should use the fdisk of Linux?

3)And another question: Do you think I can safely re-install
Win2K on the primary NTFS-partition, without affecting my other Data-NTFS-partition? I can do this now, because I can now change the boot-order. And will this overwrite the MBR?

Thanks,
Swamphen
 
"I already tried that and he gave an error, stating that
he couldn't write the MBR to disk."

- really? That's weird. Is it possible that something is wrong with your hard drive? I've never gotten an error running "fdisk /mbr" in DOS. You can probably do it in Linux too, but I've always done it in DOS.

"3)And another question: Do you think I can safely re-install
Win2K on the primary NTFS-partition, without affecting my other Data- NTFS-partition?"

- yes, you can. Make sure not to touch any other partitions during the Win2K installation.

- This will overwrite the MBR too. You will need a Linux bootdisk before you do this so that you can boot to Linux after the Win2K installation. You can create a Linux boot disk by running the "mkbootdisk" command.

"I can do this now, because I can now change the boot- order"

- what do you mean by this? Is LILO working now?

ChrisP If someone resolves an issue for you, or was helpful, please click the link on the bottom left hand corner of their post to give them a "star" letting them know they helped you.
 
* First your question:

- what do you mean by this? Is LILO working now?

No, I can change it in the BIOS Setup.

* Then the chronological actions I've taken so far:

- I noticed my Win2KPro Installation CD wasn't autobootable and could only be used inside a Windows-environment (so, not DOS).

- I set up my diskdrive as the slave drive and used the lent diskdrive with Win98 on it as master drive.

- In Win98 I activated the Win2K-installation, and pointed out somewhere during that installation that I wanted to explicitly choose the partition where Win2K had to be installed.

- This way I could further on install Win2k on the NTFS-partition of the slave drive.

- Now, when booting the first (lent) drive I was presented the option to either use Win2000 or either use Win98.

- The next step was making my drive master drive again, booting to DOS and extracting a ghost-image of my former Win2k-installation to the primary NTFS-partition. I tried to this as well starting from the lent drive as master drive, but then ghost gave errors.

- So, at this point, I can boot with the lent drive as master drive and my drive as slave drive, I will be presented an option whether to use Win98 or Win2000 and if choose the latter, I will get my old Win2000 back.

- But if I set my drive as master drive and boot I will still get the LiLo. So the installation didn't overwrite the MBR.

- Now I can maybe consider to try the BootMagic program of PowerQuest Partition Manager. I will keep you informed of the result.

Greetings,
Swamphen
 
The BootMagic program isn't of much help.

So, once I will have to return the other hard drive, I will not be able to start Win 2000 any more.

I am really in need of ideas here...

Swamphen
 
Problem +/- solved
------------------

What did I do?

1) With my drive (ie not the lent harddrive with Win98) as master drive I did chronologically:

A. Boot to linux with linux boot floppy (this didn't work with the lent drive as master drive and my drive as slave drive).
B. "lilo -u": some error with the backed up mbr
C. fdisk to see how many partitions there were
E. "dd if=/dev/zero of=/dev/hda bs=352 count=1" (352=512-((nbPartiotions+2)*8); 2 as a saftey measure not to mess up the partition table)
F. Rebooted (without floppy) but only LI appeared and then nothing
G. Booted to DOS
H. Did fdisk /mbr: This time it didn't give an error, probably because of the previous "dd command"
I. Set the first partition active
J. Rebooted: Windows started up, but I didn't get further then giving in the password. It automatically logged back out.
K. Booted to DOS
J. restored .gho-file
K. Made first partition active with fdisk: The first partition was now shown as an NTFS partition whereas in step I it was shown as Non-DOS.
J. Rebooted and Windows started successfully


And now I can finally think about the Linux installment again. Probably you will here from me again.

Thanks all,
Swamphen
 
This 'LI' of lilo problem was what I had before I tried installing the new version of Linux.

Hopefully if I try this solution to I will have a working system.

Cheers,
Leon.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top