PC won't boot, Trashed partition table? Help required

Mark Ovens mark at freebsd-uk.eu.org
Thu Jun 8 17:30:13 BST 2000


Brian Somers wrote:
> 
> > Brian Somers wrote:
> > >
> > > This sounds bad - as you say, it looks like FreeBSD has trashed your
> > > boot record.
> > >
> > > You can still boot from a FreeBSD fixit and run fdisk -u ad0 (or da0)
> >
> > What exactly does ``fdisk -u'' do (since I don't have access to the
> > manpages).
> 
> It allows you to edit the partition table, prompting you for
> start/offset sectors, system ids and boot bits.
> 
> > One thing I would like, if someone will do it, is the output of
> >
> >       dd if=/dev/rda0s2 of=/tmp/foobar bs=512 count=8
> >
> > (obviously changing rda0s2 to the appropriate slice where / is) to
> > hopefully identify the start of the BSD slice (I've got Norton's
> > diskedit).
> 
> You're looking for /boot/boot1.  I'll mail you a copy seperately.
> 

Fixed it! :)

Thanks for the copy of boot1, using that to find the FreeBSD partition
and an article in the M$ Knowledge Base that listed the start of an NT
(partition) boot sector in binary and ASCII I have managed to rebuild my
Partition Table and got all 3 OSes running without losing a single byte!

It took a while because the start of the partitions didn't fall on
cylinder boundaries and although the disk geometry, 1018/132/63 fits
into the BIOS limits I originally FDISK'd it with DOS so it had changed
the geometry to 527/255/63 (I was able to boot a Fixit floppy and look
at the dmesg file to find out the geometry used - /var is /usr/var on
another disk).

Just to cap it all it took so long to repair it that I forgot to copy
boot1 to C:\BOOTSECT.BSD to replace boot0, so you can guess what
happened - that's right - the first time I booted FreeBSD it did the
same thing. At least this time it only took 5 minutes to fix.

I might look into this further, but it seems to me that boot0 should be
modified to prevent this happening. I guess when boot0 is installed by
sysinstall it writes the partition table back to the MBR, and when you
boot from it and it just writes the detail of the partition you have
just booted (so it is the default next boot) it writes all 512 bytes to
the MBR so the Partition Table area is all 0x00's. Perhaps it should be
modified to only write the first 446 bytes so the PT is untouched so
that if someone does what I did it won't trash the PT. OK, I know it was
a stupid thing to do but it was unintentional and anyone could do it,
but a simple mistake shouldn't cause such major damage.

BTW, I've now backed up my MBR!

Thanks for your help. I owe you a pint.

> > I have found a sector with "da0s3" near the start which is the correct
> > slice number, so I'm guessing that this is the start of the FreeBSD
> > slice. Also, is the total number of sectors in the slice stored anywhere
> > within the slice at a known location (it must be somewhere so that
> > FreeBSD knows where the slice ends).
> >
> > Finally, is there a way of stopping fsck running at boot if it finds
> > something wrong?, just in case I do get it to boot, but have the end of
> > the slice wrong in the partition table.
> >
> > Thanks
> >
> > > if you can remember the partition sizes, but it's hard to say how
> > > much of the NT loader has been kak'd on.
> > >
> > > > Apologies if this is rather long but I've lost 'net access at home so am
> > > > sending this from work and want to include as much info as I can since I
> > > > can't check things.
> > > >
> > > > My PC will no longer boot due, I believe, to a trashed partition table.
> > > >
> > > > I triple boot Win95, NT4, Freebsd 4-STABLE using the NT boot manager.
> > > > The system is spread over 2 disks:
> > > >
> > > >       Disk 0  512MB FAT - Win95
> > > >               ~320MB UFS - /, var, swap
> > > >               rest of disk is NTFS in an extended partition
> > > >
> > > >       Disk 1
> > > >               Whole disk is UFS, /usr (*not* dangerously dedicated)
> > > >
> > > > To allow FreeBSD to boot from the NT loader I copy /boot/boot1 to
> > > > C:\BOOTSECT.BSD and add an entry to C:\BOOT.INI. This has been set up
> > > > this way for years.
> > > >
> > > > After doing a make world I check if /boot/boot1 has changed by
> > > > diff(1)'ing it against C:\BOOTSECT.BSD and if different copying the
> > > > former to the latter.
> > > >
> > > > Last night I did this (copied boot1) and re-booted. I have a habit of
> > > > selecting FreeBSD from the NT menu and hitting RETRUN 3 times to start
> > > > it booting and bypass the "twirling baton" and 10-second countdown.
> > > > Instead of booting I saw:
> > > >
> > > >       F5 Drive 1
> > > >
> > > >       Default F5
> > > >
> > > >       _
> > > >
> > > > It took me a couple of minutes to realize that I'd copied boot0, not
> > > > boot1. OK, just re-boot and copy the old BOOTSECT.BSD back (yes, I'd
> > > > backed it up), however on reboot, instead of the NT loader menu I just
> > > > got the "F5 Drive 1" display and no boot. It took a while to realize
> > > > that the FreeBSD boot manager remembers the last partition booted and
> > > > the only place it can store this info is in the MBR, so it had written a
> > > > copy of itself to the MBR.
> > > >
> > > > No problem, just boot from the NT setup disks, select Repair and tell it
> > > > to repair the boot sector (the NT equivalent of FDISK /MBR). NT
> > > > complained that it couldn't find a valid NT install to repair, unless I
> > > > had the Emergency Repair Disk (I had made one, but can't find it :( ).
> > > >
> > > > Booting from a DOS floppy resulted in "Invalid drive specification" when
> > > > trying to change to C:.
> > > >
> > > > I booted from another floppy which has the command line version of
> > > > Partition Magic on it. PM saw the whole of the first disk as free space
> > > > (yes it can recognize UFS partitions).
> > > >
> > > > The only option left was to FDISK /MBR, but now all I get is "PRESS A
> > > > KEY TO REBOOT" when booting from the HD.
> > > >
> > > > All this suggests that the partition table is trashed, but why? Surely
> > > > boot0 should only affect the MBR, not the partition table.
> > > >
> > > > Any idea what has happened here?
> > > >
> > > > Is it the partition table that is trashed?
> > > >
> > > > Is there a way of recovering without having to re-install everything?
> > > >
> > > > Can anyone help me here please?
> > > >
> > > > Please Cc: me as I've no access to my list e-mail at the moment.
> > > >
> > > > TIA.
> > > >
> > > > ------ FreeBSD UK User's Group  -  Mailing List ------
> > > > http://listserver.uk.freebsd.org/mailman/listinfo/freebsd-users
> 
> --
> Brian <brian at Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
>       <http://www.Awfulhak.org>                   <brian@[uk.]OpenBSD.org>
> Don't _EVER_ lose your sense of humour !




More information about the Ukfreebsd mailing list