LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where, Is, The, Stupid, MBR (https://www.linuxquestions.org/questions/linux-newbie-8/where-is-the-stupid-mbr-143025/)

admanb 02-06-2004 12:29 PM

Where, Is, The, Stupid, MBR
 
This is all I need to know, where does the MBR install? BIOS? Does it automatically install to hda, no matter which HD Linux is on? HELP! Please, only reply if you have a definite answer, I've gotten enough "I think..."s on this, :).

DrOzz 02-06-2004 12:40 PM

the master boot record (or MBR) is the very first thing written in the first sector of a hard drive ... the master boot program is followed by the partition table itself, and both are stored in the master boot sector. the BIOS executes this master boot program, which examines the partition table, looking for the location of the active partition on the drive, and then turns to the first sector of the active partition to find and load the program in the boot sector of the active partition ...

artur 02-06-2004 12:47 PM

I don't see any replies to your post. Why do you complain about "I think"s? You would avoid the "I think" frustration if you bothered to try http://www.google.com/search?q=MBR+linux+delete+dd

Anyway, BIOS is a piece of software stored on a flash chip on your mobo. Among other things it has the code that reads MBR from the HD and executes the code in it.

Now the answer to your question: MBR is stored in the first 512 bytes in the very beginning of the hard drive, before any partitions. You can read it by:
dd if=/dev/hda of=my_save_file.bin bs=512 count=1

admanb 02-06-2004 12:53 PM

Hehe, sorry, I've posted other posts on various topics about partitioning and dual-booting, and never figured out exactly where the MBR is, ^_^. My only question now is, will Linux install GRUB to a HD other then hda? My BIOS will boot it, I just need to know if it can install it.

artur 02-06-2004 01:05 PM

man grub-install

google: grub install hdb

admanb 02-06-2004 01:13 PM

Alright, thanks. I guess I'm going to be installing as a single-boot system, then setting it up to dual-boot.

bnice 02-06-2004 01:15 PM

Yes.

As artur and DrOzz stated, the MBR is the first 512 bytes of *EACH* drive.
I use lilo, installed to the MBR of the second drive & switch boot drive in BIOS on the rare occasion that I boot into XP. Works slicker than snot.

unless a local grub guru tells you otherwise,

/sbin/grub-install /dev/hdb

should do the trick

frandalla 02-06-2004 01:17 PM

The BIOS will read the MBR from the disk specified on the BIOS Setup to be the boot disk.... What I mean is, you set on your BIOS if the CD will be a bootable device, in the same way you can set anyone of the IDEs to be the bootable device. What is done usually is: CD first boot device, floppy (who still uses'em?) second and HDD-0 third. If you want to boot from the second disk (HDB) you just change this HDD-0 to HDD-1. Easy like this :D

admanb 02-06-2004 02:09 PM

What I'm going to do is unplug the Windows drive before I install Linux. My only question is, do I have to set up the Linux drive as hda (primary master) in order to install correctly? Or is it ok to have it as hdc?

artur 02-13-2004 10:49 AM

If your system recognizes the drive as hda during the installation, and then as hdc during normal operation, after you plug in the Windows drive - things will break. your /etc/fstab will still have entries for /dev/hda for partitions that are now on /dev/hdc. Also your grub/lilo config file will need to be updated and bootloader reinstalled. It's easy to fix these problems as long as you can boot off of something else into linux. Might get tricky (but not impossible) if your install is the only bootable linux you have. Some BIOSes/installers do call first drive on the second bus "hdc" even if theres nothing plugged in into the first bus, so YMMV.

subaruwrx 03-28-2004 03:18 AM

2 questions here.

1) Is it possible to have more than 1 bootloader in the MBR?

2) What does the fix mbr command do? "format" the mbr?

subaruwrx 03-30-2004 04:10 AM

Quote:

Originally posted by subaruwrx
2 questions here.

1) Is it possible to have more than 1 bootloader in the MBR?

2) What does the fix mbr command do? "format" the mbr?

hmm....?

Demonbane 03-30-2004 04:34 AM

Quote:

1) Is it possible to have more than 1 bootloader in the MBR?
The MBR is programmable so I suppose its possible, but what's the point?

Quote:

2) What does the fix mbr command do? "format" the mbr?
It restores the dos/windows MBR, which looks for an active partition and load the partition bootsector.

if you want to wipe out your MBR clean(without touching the partition table), this can do it:
Code:

dd if=/dev/zero of=/dev/hda bs=446 count=1
change hda to the drive you prefer

subaruwrx 03-30-2004 05:27 AM

Quote:

Originally posted by Demonbane


It restores the dos/windows MBR, which looks for an active partition and load the partition bootsector.

if you want to wipe out your MBR clean(without touching the partition table), this can do it:
Code:

dd if=/dev/zero of=/dev/hda bs=446 count=1
change hda to the drive you prefer

Is there any good web site where I can read more about the partition table, partition bootsector?

Regarding the codes, where do I type that at?

Demonbane 03-30-2004 12:17 PM

This site has some good information on MBR, partition tables etc:
http://www.ata-atapi.com/hiwmbr.htm

Quote:

Regarding the codes, where do I type that at?
In a terminal, you need to be root to have raw access to the device.


All times are GMT -5. The time now is 02:51 PM.