[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: where does grub put the MBR?



Digby Tarvin wrote:
On Thu, May 04, 2006 at 04:16:08PM -0500, Nate Bargmann wrote:
* Alvin Oga <aoga@mail.Linux-Consulting.com> [2006 May 03 07:06 -0500]:

Well the MBR, is always in the same place.  It is *always* the first 512
bytes on the physical disk.
the MBR is the first 446 bytes of each partition ....
	16 bytes for each of the 4 primary partition
	 2 bytes for the boot flag

and if you have more than one partition, the "boot record" is the
first 448 bytes of each primary primary
So, the MBR (first 512 octets) contains the partition information for
up to four primary partitions or one to three primaries and one extended.
Where are succeeding partition (hda5 and higher) records kept for partitions in an extended partition?

In the extended partitions themselves. The extended partition has its
own MBR which contains two partitions entries - one for a logical
partition, and the second for another 'extended partition' which
repeats the process.
Hence there is no limit to the number of logical partitions, but if a
logical partition is corrupted, you lose all of the partitions which follow.

This is the output of a program I wrote some time ago to display all of
the partitioning information on my drives:
[LILO] Master Boot Record 00000000:00000000
[MWIN] Part 0: 00 01-000-01 06 fe-0c2-3f 0000003f  3132612 (DOS 16-bit >=32)
[BSDI] Part 1: 00 00-0c3-01 9f fe-185-3f 002fcd03  3132675 (BSD/OS)
       Part 2: 00 00-186-01 83 fe-247-3f 005f9a06  3116610 (Linux native)
       Part 3: 00 00-248-01 05 fe-3ff-3f 008f2848 146914425 (Extended)
       Master Boot Record 00000000:008f2848
[MWIN] Part 0: 00 01-248-01 06 fe-287-3f 0000003f  1028097 (DOS 16-bit >=32)
       Part 1: 00 00-288-01 05 fe-298-3f 000fb040   273105 (Extended)
       Master Boot Record 000fb040:008f2848
[LILO] Part 0: 00 01-288-01 83 fe-298-3f 0000003f   273042 (Linux native)
       Part 1: 00 00-299-01 05 fe-2a6-3f 0013db11   224910 (Extended)
       Master Boot Record 0013db11:008f2848
       Part 0: 00 01-299-01 82 fe-2a6-3f 0000003f   224847 (Linux swap)
       Part 1: 00 00-2a7-01 05 fe-3ac-3f 0017499f  4209030 (Extended)
       Master Boot Record 0017499f:008f2848
       Part 0: 00 01-2a7-01 83 fe-3ac-3f 0000003f  4208967 (Linux native)
	.
	.
	.

The bracketed information on the left identifies the type of boot
code found in the first sector of the partition.


Nice program. The reason I originally asked was that this a VMware VM and it had Sarge 2.6.8 installed with grub. I restored Sarge with 2.6.16-ck8 with Lilo to it and was afraid that if I put the MBR with the boot=hda sequence in a different place than grub had done it might not boot any longer.


Who knows. I left it boot=hda and it booted OK with Lilo although hda is a physical disk that has only one (the last) partition open R/W because I don't know how to do that ro.

H.









Reply to: