LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-06-2004, 01:29 PM   #1
admanb
Member
 
Registered: Jul 2003
Distribution: Libranet 2.8.1, the best Debian-based distro out there.
Posts: 43

Rep: Reputation: 15
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, .
 
Old 02-06-2004, 01:40 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 59
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 ...
 
Old 02-06-2004, 01:47 PM   #3
artur
Member
 
Registered: Apr 2002
Location: Illinois, US
Distribution: Red Hat, Fedora, Yellow Dog, Debian, FreeBSD, Embedix
Posts: 106

Rep: Reputation: 15
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
 
Old 02-06-2004, 01:53 PM   #4
admanb
Member
 
Registered: Jul 2003
Distribution: Libranet 2.8.1, the best Debian-based distro out there.
Posts: 43

Original Poster
Rep: Reputation: 15
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.
 
Old 02-06-2004, 02:05 PM   #5
artur
Member
 
Registered: Apr 2002
Location: Illinois, US
Distribution: Red Hat, Fedora, Yellow Dog, Debian, FreeBSD, Embedix
Posts: 106

Rep: Reputation: 15
man grub-install

google: grub install hdb
 
Old 02-06-2004, 02:13 PM   #6
admanb
Member
 
Registered: Jul 2003
Distribution: Libranet 2.8.1, the best Debian-based distro out there.
Posts: 43

Original Poster
Rep: Reputation: 15
Alright, thanks. I guess I'm going to be installing as a single-boot system, then setting it up to dual-boot.
 
Old 02-06-2004, 02:15 PM   #7
bnice
Member
 
Registered: Feb 2004
Location: Sacramento, CA
Distribution: Slack 9.1, slackware-current
Posts: 284

Rep: Reputation: 30
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
 
Old 02-06-2004, 02:17 PM   #8
frandalla
Member
 
Registered: Oct 2003
Location: Tokyo - Japan
Distribution: Slackware
Posts: 348
Blog Entries: 1

Rep: Reputation: 37
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
 
Old 02-06-2004, 03:09 PM   #9
admanb
Member
 
Registered: Jul 2003
Distribution: Libranet 2.8.1, the best Debian-based distro out there.
Posts: 43

Original Poster
Rep: Reputation: 15
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?
 
Old 02-13-2004, 11:49 AM   #10
artur
Member
 
Registered: Apr 2002
Location: Illinois, US
Distribution: Red Hat, Fedora, Yellow Dog, Debian, FreeBSD, Embedix
Posts: 106

Rep: Reputation: 15
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.
 
Old 03-28-2004, 04:18 AM   #11
subaruwrx
Member
 
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Rep: Reputation: 30
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?
 
Old 03-30-2004, 05:10 AM   #12
subaruwrx
Member
 
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Rep: Reputation: 30
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....?
 
Old 03-30-2004, 05:34 AM   #13
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
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

Last edited by Demonbane; 03-30-2004 at 05:35 AM.
 
Old 03-30-2004, 06:27 AM   #14
subaruwrx
Member
 
Registered: Mar 2004
Distribution: Ubuntu Feisty
Posts: 641

Rep: Reputation: 30
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?
 
Old 03-30-2004, 01:17 PM   #15
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stupid, stupid question; I lost Klaptop. :( Surfrider Slackware 2 08-31-2005 10:12 PM
MBR zeroed. Can I verify backup MBR? TomF Linux - General 7 06-20-2005 06:28 PM
by tring to fix the MBR i damage the MBR that was help... AKAKAK Fedora 4 03-21-2005 09:18 AM
GRUB MBR overwritten by WIN98 MBR TOuseef Linux - General 7 11-14-2004 05:25 PM
Stupid Windws MBR CRAP! fantacmet General 5 01-30-2004 12:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration