*BSD News Article 39035


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!werple.apana.org.au!otis.apana.org.au!serval.net.wsu.edu!netnews.nwnet.net!oracle.pnl.gov!osi-east2.es.net!cronkite.nersc.gov!dancer.ca.sandia.gov!overload.lbl.gov!lll-winken.llnl.gov!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!pipex!uunet!heifetz.msen.com!zib-berlin.de!ceres.fokus.gmd.de!nntp.gmd.de!urmel.informatik.rwth-aachen.de!thomas
From: thomas@ghpc8.ihf.rwth-aachen.de (Thomas Gellekum)
Newsgroups: comp.os.386bsd.questions
Subject: Re: Removing MBR code
Date: 6 Dec 1994 08:35:53 GMT
Organization: Inst. f. Hochfrequenztechnik
Lines: 61
Message-ID: <3c17pa$t5q@urmel.informatik.rwth-aachen.de>
References: <3buj8c$7u0@Radon.Stanford.EDU>
NNTP-Posting-Host: ghpc6.ihf.rwth-aachen.de
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Newsreader: TIN [version 1.2 PL2]

Michael K. Minakami (minakami@Xenon.Stanford.EDU) wrote:

> I installed the MBR code through FreeBSD 2.0's fdisk and would now
> like to remove it (and switch back to OS/2 boot manager). Can someone
> tell me how to do this? No matter what I do, including installing
> OS/2 boot manager, FreeBSD's boot manager remains. 

CAUTION:  Whatever you do to your MBR, double check every action.  If
you're the nervous type triple check it. [1]

I won't go into details since I'd have to type them in from memory, but
the procedure could be as follows:

- Make a copy of your current MBR and put it on a bootable MSDOS disk.
  There should be a program like restorrb.exe in the tools/dos-tools
  directory of your favourite FreeBSD archive which you can use to
  restore the MBR. If you use DOS to extract the MBR, its location is:
  disk 2 (= c:), head 0, track 0, sector 1. Under FreeBSD just do a
  `dd if=/dev/rwd0d of=mbr.wd0 count=1'. Read the dd(1) man page for
  details.

- But MSDOS from floppy. The boot disk should contain the current MBR,
  fdisk, debug or any binary editor you are able to use.

- Run fdisk /mbr. This should write a clean MBR, if I am not mistaken.

- Extract this new MBR into a file on the floppy, using debug or maybe
  the menu of OS-BS (also from tools/dos-tools).

- Copy the last 66 (decimal) bytes from your backed up current MBR to
  the freshly created. That's address 0x1be - 0x1ff. These bytes
  contain the partition table. The last two bytes should be 0x55 0xaa.

- Write this edited MBR back to the hard disk.

- Cross your fingers, send a prayer and/or check to your favourite deity
  and reboot from the hard disk.

- Should the improbable happen and this boots as expected you're set.
  In any other case reboot from the MSDOS floppy again and restore your
  current MBR.

In any case: READ THE DOCUMENTATION TO THE PROGRAMS YOU'RE USING
WHILE TRYING THIS. It's probably a good idea to check the
tools/dos-tools directory for any helpful utilities.

In case I _am_ mistaken about the behaviour of fdisk /mbr, you should be
able to use the MBR from a friend's hard disk with the partition table
edited as described above.

Once again: Do this at your own risk and be aware that this could
destroy valuable contents of your hard disk.

Jordan, if you've followed so far: it's maybe a good idea to save the
old MBR before installing the boot manager and provide an option to put
it back in /stand/sysinstall.

[1] with apologies to ast.

tg