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

Re: where does grub put the MBR?



Alvin Oga wrote:
> On Wed, 3 May 2006, Hugo Vanwoerkom wrote:
> 
> > Roberto C. Sanchez wrote:
> > > Hugo Vanwoerkom wrote:
> > >> Hi,
> > >>
> > >> Is there a way to know *for sure* where grub puts the MBR? (No
setup
> > >> command)
> 
> yes...
> 
> > > 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
> 
> >  Now, what I think you want to ask is,
> > > "where does grub install itself?"  As to that, I don't know,
other than
> > > scanning the disk and its partitions to see.  Though, I am not
certain
> > > how one would do that.
> 
> grub stage1 or lilo, etc is loaded by the bios into 0x7C00
> grub stage1.5 is loaded by the bios into 0x8K
> 
> > And what would I look for?
> 
> you don't ...  but if you insist... use a diskeditor to read the
contents
> of any random cylinder/head/sector "to look for" stuff.


To expand just a bit on alvin's comments (who knows more than I about
this I'm sure) and I'm not sure how this will help you, but;

As a user from a terminal/console;

~$ sudo dd if=/dev/hda bs=512 count=2 | xxd

	0000000: eb48 90d0 bc00 7cfb 5007 501f fcbe 1b7c  .H....|.P.P....|
	0000010: bf1b 0650 57b9 e501 f3a4 cbbe be07 b104  ...PW...........
	0000020: 382c 7c09 7515 83c6 10e2 f5cd 188b 148b  8,|.u...........
	0000030: ee83 c610 4974 1638 2c74 f6be 1007 0302  ....It.8,t......
	
	....
	
	0000160: 00eb 0ebe 847d e838 00eb 06be 8e7d e830  .....}.8.....}.0
	0000170: 00be 937d e82a 00eb fe47 5255 4220 0047  ...}.*...GRUB .G
	0000180: 656f 6d00 4861 7264 2044 6973 6b00 5265  eom.Hard Disk.Re
	0000190: 6164 0020 4572 726f 7200 bb01 00b4 0ecd  ad. Error.......
	
	....
	
	0000300: 00eb fe4c 6f61 6469 6e67 2073 7461 6765  ...Loading stage
	0000310: 312e 3500 2e00 0d0a 0047 656f 6d00 5265  1.5......Geom.Re
	0000320: 6164 0020 4572 726f 7200 bb01 00b4 0ecd  ad. Error.......
	
	....
	
	0000410: 0200 302e 3935 00ff ff00 812f 626f 6f74  ..0.95...../boot
	0000420: 2f67 7275 622f 7374 6167 6532 202f 626f  /grub/stage2 /bo
	0000430: 6f74 2f67 7275 622f 6d65 6e75 2e6c 7374  ot/grub/menu.lst
	
	

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



Reply to: