Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Charlie Roo » Thu, 29 Jun 2000 04:00:00



While lurking at microsoft.public.windowsnt.misc there was a question by a
lady, "how to uninstall NT but retain 98 because NT bloating her HD?"  One
NT guy said 10-minutes to do.  I said back up your data and reload 98 at
first drive's primary partition.  Two guys insisting their NT/95/98 do MBR
not that I know of.  I found
http://www.ntfaq.com/ntfaq/filesystems46.html#filesystems46 explaining it
wrong, no wonder.

See this simple explanation by a Linux geek at
http://www.linux.ps.pl/doc/LDP/LDP/sag-0.5/node36.html
about MBR, boot sectors and partition table and
http://www.linux.ps.pl/doc/LDP/LDP/sag-0.5/node37.html
"figure 4.2: A sample hard disk partitioning."  Notice 'boot sector' are
both present in primary and extended partition.

Some years ago I couldn't figure how to multiple boot NT, Linux, 95 and WFW
3.11 in one Intel box using NT OS boot loader so I bought a System Commander
installed it in my primary hard drive's first partition.  I reformatted the
hard drive afterwards and reinstalled all OS all over but some d*rn message
kept popping.  Surely I whacked the NT boot sector and System Commander
files with just 'format C:\ /U' but why still this weird pop up message
after POST?  I was pissed, actually returned the System Commander the V-Com
tech support e-mail reply came too late with 'fdisk /mbr' explaining what is
MBR from boot sector.  Some stuff I didn't learn in the university.

I don't have hard time explaining MBR and boot sector to newbies but NT
folks sez MBR is also boot sector.  Can you fellah Linux folks explain to
the NT people what is MBR from boot sector?  Btw, this is not advocacy
group, so no ranting please.

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by charlie.r.. » Thu, 29 Jun 2000 04:00:00



While lurking at microsoft.public.windowsnt.misc there was a question
 by a
lady, "how to uninstall NT but retain 98 because NT bloating her HD?"
  One
NT guy said 10-minutes to do.  I said back up your data and reload 98
 at
first drive's primary partition.  Two guys insisting their NT/95/98
 do MBR
not that I know of.  I found
http://www.ntfaq.com/ntfaq/filesystems46.html#filesystems46
 explaining it
wrong, no wonder.

See this simple explanation by a Linux geek at
http://www.linux.ps.pl/doc/LDP/LDP/sag-0.5/node36.html
about MBR, boot sectors and partition table and
http://www.linux.ps.pl/doc/LDP/LDP/sag-0.5/node37.html
"figure 4.2: A sample hard disk partitioning."  Notice 'boot sector'
 are
both present in primary and extended partition.

Some years ago I couldn't figure how to multiple boot NT, Linux, 95
 and WFW
3.11 in one Intel box using NT OS boot loader so I bought a System
 Commander
installed it in my primary hard drive's first partition.  I
 reformatted the
hard drive afterwards and reinstalled all OS all over but some d*rn
 message
kept popping.  Surely I whacked the NT boot sector and System
 Commander
files with just 'format C:\ /U' but why still this weird pop up
 message
after POST?  I was pissed, actually returned the System Commander the
 V-Com
tech support e-mail reply came too late with 'fdisk /mbr' explaining
 what is
MBR from boot sector.  Some stuff I didn't learn in the university.

I don't have hard time explaining MBR and boot sector to newbies but
 NT
folks sez MBR is also boot sector.  Can you fellah Linux folks
 explain to
the NT people what is MBR from boot sector?  Btw, this is not
 advocacy
group, so no ranting please.

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Rod Smi » Thu, 29 Jun 2000 04:00:00




Quote:

> I don't have hard time explaining MBR and boot sector to newbies but NT
> folks sez MBR is also boot sector.  Can you fellah Linux folks explain to
> the NT people what is MBR from boot sector?  Btw, this is not advocacy
> group, so no ranting please.

MBR = Master Boot Record. It's an area at the very start of the
physical hard disk, which contains the very first bit of code that a
computer runs from the hard disk, as well as the description of the
layout of the primary and extended partitions (up to four of them).

A boot sector is the first sector of a drive -- normally the first
sector of a floppy disk or of a PARTITION on a hard disk. In the latter
case, it contains code that's loaded by the MBR during the booting of
the computer, assuming the partition is the one being booted.

In some sense, the MBR is a boot sector, but the term "boot sector"
usually isn't applied to the MBR.

FWIW, I cover these matters in more detail in my book, _The Multi-Boot
Configuration Handbook_ (http://www.rodsbooks.com/multiboot/).

--

http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Charlie Roo » Thu, 29 Jun 2000 04:00:00


Very well, Rod.  Thanks.  At least I got to my point here.  I think it has
benefit playing around with other alternative operations other than just
Microsoft Windozes..

Windows NT folks, please get the book if any more argument about
complicating what is 'boot sector' from Master Boot Record.




>> I don't have hard time explaining MBR and boot sector to newbies but NT
>> folks sez MBR is also boot sector.  Can you fellah Linux folks explain to
>> the NT people what is MBR from boot sector?  Btw, this is not advocacy
>> group, so no ranting please.

>MBR = Master Boot Record. It's an area at the very start of the
>physical hard disk, which contains the very first bit of code that a
>computer runs from the hard disk, as well as the description of the
>layout of the primary and extended partitions (up to four of them).

>A boot sector is the first sector of a drive -- normally the first
>sector of a floppy disk or of a PARTITION on a hard disk. In the latter
>case, it contains code that's loaded by the MBR during the booting of
>the computer, assuming the partition is the one being booted.

>In some sense, the MBR is a boot sector, but the term "boot sector"
>usually isn't applied to the MBR.

>FWIW, I cover these matters in more detail in my book, _The Multi-Boot
>Configuration Handbook_ (http://www.rodsbooks.com/multiboot/).

>--

>http://www.rodsbooks.com
>Author of books on Linux networking & multi-OS configuration

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Bruce Merr » Thu, 29 Jun 2000 04:00:00


<snip quite a lot of stuff>

As I understand it, every primary partition has a boot section, which
are the first 512 bytes of that partition (an extended partition is a
type of primary partition, although I don't think MS OS's will let you
put anything in its boot sector. The MBR is the master boot record and
this is the first 512 bytes of the entire disk. It contains the first
stage boot up code and I think also the partition table.

At this point I'm not too sure but what I think happens is that with a
default MBR, the BIOS will copy the MBR into memory on startup and the
code in the MBR then loads the boot sector from the first active
partition, which in turn loads the OS in that partition. Alternately you
might have a boot manager with some code in the MBR (I believe NT does
this) to select which partition you want to boot.

B4N
Bruce
/--------------------------------------------------------------------\
| Bruce Merry (Entropy)            | bmerry at iafrica dot com       |
| Proud user of Linux!             | http://www.cs.uct.ac.za/~bmerry |
|                A radio-active cat has 18 half-lives                |
\--------------------------------------------------------------------/

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by mla.. » Thu, 29 Jun 2000 04:00:00




> <snip quite a lot of stuff>

> As I understand it, every primary partition has a boot section, which
> are the first 512 bytes of that partition (an extended partition is a
> type of primary partition, although I don't think MS OS's will let you
> put anything in its boot sector. The MBR is the master boot record and
> this is the first 512 bytes of the entire disk. It contains the first
> stage boot up code and I think also the partition table.

> At this point I'm not too sure but what I think happens is that with a
> default MBR, the BIOS will copy the MBR into memory on startup and the
> code in the MBR then loads the boot sector from the first active
> partition, which in turn loads the OS in that partition. Alternately you
> might have a boot manager with some code in the MBR (I believe NT does
> this) to select which partition you want to boot.

> B4N
> Bruce
> /--------------------------------------------------------------------\
> | Bruce Merry (Entropy)            | bmerry at iafrica dot com       |
> | Proud user of Linux!             | http://www.cs.uct.ac.za/~bmerry |
> |                A radio-active cat has 18 half-lives                |
> \--------------------------------------------------------------------/

Thank you.  Some one knows what they are talking about -- I not sure
about BIOS copying MBR into memory though.  When the computer first
boots up, it looks for the first sector at cylinder 0, side 0 -- where
the first boot sector is located (called MBR).  This sector (MBR)
contains a small code (IPL) that tells the computer how to boot.  Win95
will replace this code, as does Win NT -- the program is responsible for
displaying OS's to choose from if you upgrade to NT from previous
versions of Windows, like LILO.

If you, Mr. Root, still insist that Win95/NT does not modify the MBR,
get a program that you know is going to modify the MBR, then install
WinNT.  This should be evidence enough.

Michael

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by fyw.. » Thu, 29 Jun 2000 04:00:00


Hi all,

The following program is valid for MSDOS6.2 or older.

C:\>debug
-a
0AD7:0100 movax,201
0AD7:0103 movbx,7c00
0AD7:0106 movcx,1
0AD7:0109 movdx,80
0AD7:010C int13
0AD7:010E int3
0AD7:010F
-g
-d7c00 7dff
You can see the Master Boot Record now.

-d7dbe 7dfd
You can see the partition table (4 entries) now.

-f7dbe 7dfd 0
Clear the partition table.

-a
0AD7:010F movax,301
0AD7:0112
-g=100
Write the MBR back to hard disk.
You should have deleted all partitions in this hard disk, and you can
repartition it now.

I have used this simple technique to remove NT & Win2000 partitions for
times.

If you have enabled the anti virus function in BIOS, the computer will
show a small box to warn you when you try to write back the MBR.

As I know, BIOS load MBR to 0:7c00, then jumt to this address. Magic
begins from this point.

-u100
You can see the MBR code, or a MBR virus code maybe. :)
It usually move itself to other place, then load the activated
partition's boot sector to 0:7c00.

Tom Wang

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by mla.. » Thu, 29 Jun 2000 04:00:00





> > I not sure
> > about BIOS copying MBR into memory though.  When the computer first
> > boots up, it looks for the first sector at cylinder 0, side 0 -- where
> > the first boot sector is located (called MBR).  This sector (MBR)
> > contains a small code (IPL) that tells the computer how to boot.

> In other words, the computer loads it into memory.

> > Win95
> > will replace this code, as does Win NT -- the program is responsible for
> > displaying OS's to choose from if you upgrade to NT from previous
> > versions of Windows, like LILO.

> Although Win9x and NT both replace the MBR when they install, they don't
> use them for OS selection purposes. NT's OS Loader is located in the NT
> partition's boot sector. Why Microsoft feels compelled to have its OSs
> overwrite the MBR on installation I do not know.

> > If you, Mr. Root, still insist that Win95/NT does not modify the MBR,
> > get a program that you know is going to modify the MBR, then install
> > WinNT.  This should be evidence enough.

> Evidence that the MBR is overwritten, yes. Evidence that the NT boot
> loader is located there, no.

> --

> http://www.rodsbooks.com
> Author of books on Linux networking & multi-OS configuration

The MBR is loaded into memory, but I thought previous poster wrote
copying into memory -- like shadowing.  I believe you are correct about
the OS selection not being a part of the IPL.

Michael.

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Rod Smi » Fri, 30 Jun 2000 04:00:00




Quote:

> As I understand it, every primary partition has a boot section, which
> are the first 512 bytes of that partition (an extended partition is a
> type of primary partition, although I don't think MS OS's will let you
> put anything in its boot sector.

Logical partitions also contain boot sectors, although many OSs
(including all those available from Microsoft) can't boot from a logical
partition. Some OSs, though, can, including Linux, OS/2, and BeOS.

(Note that the presence of a boot sector doesn't necessarily mean that
the partition is bootable; the boot sector is just the first sector of
the partition, which has special meaning during the boot process *IF*
the partition is bootable. If the partition is not bootable, the boot
sector may still contain vital information, but that's
filesystem-dependant stuff.)

Quote:> The MBR is the master boot record and
> this is the first 512 bytes of the entire disk. It contains the first
> stage boot up code and I think also the partition table.

Correct.

Quote:> At this point I'm not too sure but what I think happens is that with a
> default MBR, the BIOS will copy the MBR into memory on startup and the
> code in the MBR then loads the boot sector from the first active
> partition, which in turn loads the OS in that partition.

Correct. This is what happens with the MBR and boot sector for something
like a default all-DOS or all-Windows 9x system.

Quote:> Alternately you
> might have a boot manager with some code in the MBR (I believe NT does
> this) to select which partition you want to boot.

NT's OS Loader is actually based in the boot sector of the partition,
not in the MBR. It also relies on files on a FAT or NTFS partition (at a
minimum its configuration file, but also possibly files that are
duplicates of other OSs' boot sectors). NT does, however, re-write the
MBR when you install it, so it'll wipe out MBR-based boot loaders. Other
boot loaders, such as Linux's LILO, can reside in the MBR (LILO can also
reside in a partition's boot sector).

--

http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Rod Smi » Fri, 30 Jun 2000 04:00:00




Quote:

> I not sure
> about BIOS copying MBR into memory though.  When the computer first
> boots up, it looks for the first sector at cylinder 0, side 0 -- where
> the first boot sector is located (called MBR).  This sector (MBR)
> contains a small code (IPL) that tells the computer how to boot.

In other words, the computer loads it into memory.

Quote:> Win95
> will replace this code, as does Win NT -- the program is responsible for
> displaying OS's to choose from if you upgrade to NT from previous
> versions of Windows, like LILO.

Although Win9x and NT both replace the MBR when they install, they don't
use them for OS selection purposes. NT's OS Loader is located in the NT
partition's boot sector. Why Microsoft feels compelled to have its OSs
overwrite the MBR on installation I do not know.

Quote:> If you, Mr. Root, still insist that Win95/NT does not modify the MBR,
> get a program that you know is going to modify the MBR, then install
> WinNT.  This should be evidence enough.

Evidence that the MBR is overwritten, yes. Evidence that the NT boot
loader is located there, no.

--

http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Juergen Pfan » Fri, 30 Jun 2000 04:00:00



> (snipped a lot of fine and consistent explanation...).
> NT does, however, re-write the
> MBR when you install it, so it'll wipe out MBR-based boot loaders. Other
> boot loaders, such as Linux's LILO, can reside in the MBR (LILO can also
> reside in a partition's boot sector).

As opposed to most of your explanation, I disagree with the item above.
NT (4.0, no experience with W2K), *does* replace a MBR if it's a
"standard" DOS or Win95/98 one. BUT it leaves a LILO MBR alone if
installed AFTER Linux (because it examines the boot code in there
and "sees" it's not the MS-based code - just guessing) - at least seen
that several times in my boxes with a FAT16 partition for W95 in
addition to a NTFS partition each. With that, the LILO entry for
the FAT(16) partition, that was previously starting W95, invokes
the NT boot manager starting from the partition boot sector
after the NT installation, which in turn offers to boot W95 via
a backup file of the previous boot sector ("bootsect.dos").
There's *no need* to reinstall LILO in such a situation - but I
normally do that anyway to have one config for NT and one for
W95 using THE SAME bootsector image that NT does (or, at least,
a copy thereof in Linux's /boot directory (it's safer there - *g*).
I think this is only possible if the W95(a) partition is *FAT16*,
as in my case, because with W95 B/C or W98's FAT32, there's no
write access to that partition, which has to be the *active* one
anyway; so with FAT32, there's only the MBR left to install
NT's booting "machinery" - but with FAT16, that works just as
fine with the partition boot sector. With the absence of LILO,
the user wouldn't see the difference, though.
Please feel free to correct me, if in turn something I just
said is wrong.
To me, the above is quite important - as with my "largest" box,
LILO has to manage 7 Linux installations, 2xWin95, NT, FreeBSD,
OpenBSD and SCO OS 5.0.5 off 5 hard disks (2 IDE & 3 SCSI at
the moment) - and I do doubt any other boot manager could do
that as flexible as LILO does; I know for sure NT boot manager
couldn't... ;-).

Just my (rather 3 than 2) cents

Juergen

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Charlie Roo » Fri, 30 Jun 2000 04:00:00





> > If you, Mr. Root, still insist that Win95/NT does not modify the MBR,
> > get a program that you know is going to modify the MBR, then install
> > WinNT.  This should be evidence enough.

> Evidence that the MBR is overwritten, yes. Evidence that the NT boot
> loader is located there, no.

Rod, still I don't buy NT ever messes with MBR because NT does not need MBR
at all.  If multibooting NT and Linux not using the LILO, NT OS loader likes
to have the boot sector from the other operating systems available as a
file. NT has 'boot.ini'that read like:
--
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ...
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Windows NT Workstation ...
C:\BOOTSECT.LNX="Linux"

Where this resides?  Not at MBR but at C:\ root directory with system and
hidden attributes.  Try boot it with MS-DOS floppy then do at C:\ prompt:
'a:\fdisk /mbr' you can still boot either OS because MBR is not being used
at all.

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Rod Smi » Fri, 30 Jun 2000 04:00:00








>> > If you, Mr. Root, still insist that Win95/NT does not modify the MBR,
>> > get a program that you know is going to modify the MBR, then install
>> > WinNT.  This should be evidence enough.

>> Evidence that the MBR is overwritten, yes. Evidence that the NT boot
>> loader is located there, no.

> Rod, still I don't buy NT ever messes with MBR because NT does not need MBR
> at all.

*EVERY* PC OS that uses the standard PC partitioning scheme needs the
MBR. The MBR holds the primary boot loader code, without which the
computer *CANNOT* boot from a hard disk. It also holds the partition
table, without which no OS can know where partitions begin and end.

Quote:> If multibooting NT and Linux not using the LILO, NT OS loader likes
> to have the boot sector from the other operating systems available as a
> file. NT has 'boot.ini'that read like:

True. This doesn't mean that the MBR isn't necessary any more than the
fact that an airplane in flight isn't using wheels means that they
aren't necessary to get into the air in the first place, though.

Quote:> Where this resides?  Not at MBR but at C:\ root directory with system and
> hidden attributes.

The configuration files reside there, but the OS Loader itself installs in
the partition's boot sector.

Quote:> Try boot it with MS-DOS floppy then do at C:\ prompt:
> 'a:\fdisk /mbr' you can still boot either OS because MBR is not being used
> at all.

No, FDISK /MBR re-writes a standard MBR. NT boots from a standard MBR.
If you really believe that the MBR isn't needed, try booting from a
Linux emergency floppy and issue this command:

dd if=/dev/zero of=/dev/hda bs=512 count=1

That will overwrite the MBR with 0s. Then NT won't boot. Hint: DO NOT try
this on any system you expect to EVER use again without reinstalling
EVERYTHING from scratch!!!!!!!!!!!!

--

http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Rod Smi » Fri, 30 Jun 2000 04:00:00





> (snipped a lot of fine and consistent explanation...).
>> NT does, however, re-write the
>> MBR when you install it, so it'll wipe out MBR-based boot loaders. Other
>> boot loaders, such as Linux's LILO, can reside in the MBR (LILO can also
>> reside in a partition's boot sector).

> As opposed to most of your explanation, I disagree with the item above.
> NT (4.0, no experience with W2K), *does* replace a MBR if it's a
> "standard" DOS or Win95/98 one. BUT it leaves a LILO MBR alone if
> installed AFTER Linux

Hmmm.... I could have sworn that NT 4.0 wiped out LILO or System
Commander (whichever I was using at the time) when I last installed it.
I might be dis-remembering, though, or maybe it just disabled a boot
loader that wasn't in the MBR, but in the boot sector of another primary
partition. It's also possible that NT's "don't-touch-the-MBR" detection
code is imperfect, so it wipes out some versions of LILO but not others.

I do know that Win2K did not touch my System Commander installation when
I installed Win2K, which surprised me. That's much friendlier behavior
than I'm used to seeing from Microsoft OS installations.

--

http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

 
 
 

Need clarification: what really is 'MBR' and what is 'BOOT SECTOR'?

Post by Rod Smi » Fri, 30 Jun 2000 04:00:00




Quote:

> The MBR is loaded into memory, but I thought previous poster wrote
> copying into memory -- like shadowing.

A previous poster did use the word "copy." Personally, I don't interpret
that as being necessarily permanent or to imply any sort of automatic
write-back operation. Of course, the poster who used the word "copy"
might have meant more by that....

--

http://www.rodsbooks.com
Author of books on Linux networking & multi-OS configuration

 
 
 

1. question about MBR's and boot sector's etc

I posted a message earlier.  It was a mess of words with little
information.  Let me just ask a few questions and maybe I can figure it
out myself:

- As I understand it (or don't understand it as the case may be), the MBR
sits on the physical disk at sector 0 (or some such sector/track).  For
each partition there is also a "boot record" of some sort that lets it
know how to boot that particular OS.

So, the way I understand it if I had this (hypothetical of course) setup
it would be as follows:
/dev/hda MBR
/dev/hda1 WIN95 (fat32)
/dev/hdd1 linux (no fat32 support)

So, what I've done is run lilo multiple times, and in it referenced
"/dev/hda" and "/dev/hda1" as my "boot" partition.

Does this overwrite my MBR AND in addition the "boot record" of the
/dev/hda1 win95 disk?

The symptoms I am having are, if I run (from a win95 boot disk) "fdisk
/mbr" it seems to clobber the "/dev/hda" stored version of lilo.  However,
when I boot it then says "LI" (instead of "LILO").  What I'm wondering is,
by using "fdisk /mbr" did I fix the MBR to boot win95 (basically changing
the pointer to /dev/hda1) and then it hits /dev/hda1 and runs into lilo
again? (because I ran it multiple times?)

Is this a valid concern?  Can lilo sit on a /dev/hda and /dev/hda1?  And
if so how do i rid it on /dev/hda1?  I know how to do /dev/hda because of
"fdisk /mbr" but it seems I am stuck.

Hopefully someone understands this problem.

TIA,
Jim

2. Lost Libs/Links

3. kde20010119 cvs: `x11r5.keytab', needed by `all-am'

4. DHCP for unix

5. How do I get 'w' to say that i am doing something else

6. AFPS--Exporting Unix Printer Descriptions to Win95 Clients

7. What am I 'make'ing

8. Problems with netscape Enterprise server 2.01

9. Why am I not 'Logged in' ?

10. Where am I 'rlogin'ing from.

11. I've read/am reading the faq's - but what is a Segmentation fault?

12. Question about 'who am i'

13. how do I know 'From Where?' I am connected?