Writing to MBR

tom oakes eoakes at comcast.net
Fri Sep 24 22:52:15 UTC 2010


I have done a clean install of freebsd 8.1 on /dev/ad4s1a with the 

# Intel Core 2 Duo Dual-Core E6300 2.8GHz 1066MHz 2MB Cache Processor

# ASRock G31M-S R2.0 Core 2 Quad/ Intel G31/ FSB 1600(OC)/ DDR2/ A&V&L/ 
MATX Motherboard

# 4GB (2X2GB) DDR2-1066 PC2 8500 Dual Channel

# Hitachi / WD 1TB 7200 RPM 32MB CACHE SATA 3.0Gb/s

 kern.geom.debugflags=15160 Gb Disk on  IDE Slave

I added X11, KDE3, emacs, and BASH from ports or packages.

/dev/ad4 has 4 slices of about 240GB. Freebsd is installed on the entire 
first slice.

File system is ufs2 on /dev/ad4s1 and /dev/ad4s2. the other 2 slices do 
not have a filesystem installed.

I did a tar of the / to an external usbdisk.

I decided to install GRUB. (I really didn't need it, the bsd boot loader 
is working. But like the way it looks and it is easy to modify)

I installed grub from the port and copied the required files to 
/boot/grub. I created a menu.lst in /boot/grub.

I created a bootable grub cd which  boots the operating system.

I then tried to copy  stage1 to the MBR with:

fdisk -B -b /boot/grub/stage1 ad4

2 prompts: one to write to MBR, which I answered 'y', and the other to 
modify the partition table that I answered 'n'.

I tried this from the hard disk boot,  my grub bootable cd, and the  
freebsd livecd.
None wrote to the MBR. The freebsd bootloader was still loaded.

I found a post that said to do a sysctl kern.geom.debugflag=16

I tried again. Still didn't work.

I found a post that said for version 8.0 or 8.1 it needed to be 17.  I 
tried that and it still didn't work.

I found a post that said to do a

gpart -bootcode -B /boot/grub/stage1 ad4

and got a message "ad4 has bootcode"
I did this both before and after doing the sysctl with 16 and 17.

It seems to me that writing the stage1 file to the MBR should be 
straight forward, so I must be missing something simple.

I don't have a critical problem, I can still boot from the freebsd 
bootloader or from my grub cd. After chasing my tail for a
couple of days trying to get grub working, I hate to just give up.

Thanks in advance for any help you can give me



More information about the freebsd-questions mailing list