16a99 reinstall MBR - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > General

General General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

Reply
 
Thread Tools Display Modes
  #1  
Old November 5th, 2011, 22:41
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default reinstall MBR

Hi

I use FreeBSD 8.2 dual boot with winXP under VirtualBOX, I'm just training with basic commands like fdisk . So after deleting my MBR using dd, I used the live CD to recover it (fdisk -B) but the FreeBSD partition table haS not been detected; only winXP can boot. Any idea how I can resolve this problem?

Last edited by DutchDaemon; November 6th, 2011 at 04:01. Reason: Formatting & Style: http://forums.freebsd.org/showthread.php?t=8816 / http://forums.freebsd.org/showthread.php?t=18043
Reply With Quote
  #2  
Old November 6th, 2011, 00:13
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

/boot/mbr is plain bootcode. It will boot the active partition. See boot0cfg(8) about the interactive bootloader /boot/boot0. Neither of these change the partition table.
Reply With Quote
  #3  
Old November 6th, 2011, 20:20
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by wblock@ View Post
/boot/mbr is plain bootcode. It will boot the active partition. See boot0cfg(8) about the interactive bootloader /boot/boot0. Neither of these change the partition table.


Same result, F1 links to Windows not to FreeBSD
Reply With Quote
  #4  
Old November 6th, 2011, 21:00
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

Maybe the partition type was changed on the Windows partition. What is the output of fdisk(8) or gpart(8) on that disk?
Reply With Quote
  #5  
Old November 6th, 2011, 22:49
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Reply With Quote
  #6  
Old November 7th, 2011, 00:16
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

# fdisk ad0
is enough. The output shows that the first partition, which appears to be the only partition, is type 0xa5, or FreeBSD.

Just guessing, I think it's actually NTFS and FreeBSD was installed on the second hard disk. Or possibly, the first disk is FreeBSD but it's not bootable, and the second disk is Windows.
Reply With Quote
  #7  
Old November 7th, 2011, 18:12
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default


partition 1 for NTFS, 2 for FreeBSD the other disk is just additional free disk

Last edited by DutchDaemon; November 7th, 2011 at 18:40. Reason: It's "FreeBSD".
Reply With Quote
  #8  
Old November 7th, 2011, 18:56
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

But that output shows partition 2 is unused. What does fdisk show for the other drive?
Reply With Quote
  #9  
Old November 7th, 2011, 19:23
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by wblock@ View Post
But that output shows partition 2 is unused.
yes and i don't know why ! physically it really exist but fdisk couldn't read it


don't care about this, it's just UFS free disk
Reply With Quote
  #10  
Old November 7th, 2011, 20:05
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

Quote:
Originally Posted by Hanzo View Post
yes and i don't know why ! physically it really exist but fdisk couldn't read it
Does some other program show the second partition being used? If the data is all there, it would just be a matter of using fdisk(8) to edit the second slice entry and put in the right start and size. Finding the start shouldn't be difficult, but the size might be. Unless it goes to the end of the disk.

First, back up at least the MBR (I would back up the whole disk) to someplace safe, then change only the type of the first partition back to NTFS, type 07. Then test and make sure it still boots Windows.

Once that's fixed, edit the second partition to use the rest of the disk, with type 165 (0xa5) for FreeBSD.
Reply With Quote
  #11  
Old November 7th, 2011, 20:19
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default

luckily i have backuped my my virtual disk before removing mbr and here is my original fdisk:
Reply With Quote
  #12  
Old November 7th, 2011, 21:57
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

Excellent! Copy just the first 512 bytes from that backup to the first block of the disk:
# dd if=backupfile of=/dev/ad0 bs=512 count=1
Reply With Quote
  #13  
Old November 7th, 2011, 22:46
Hanzo Hanzo is offline
Junior Member
 
Join Date: Oct 2011
Location: Tunisia
Posts: 9
Thanks: 4
Thanked 0 Times in 0 Posts
Default

I know but the gool of this "exercise" is to reinitialize the boot0 using basic command comparing Grub and other bootmanager and to know the limit of each ones.

Last edited by DutchDaemon; November 8th, 2011 at 01:30.
Reply With Quote
  #14  
Old November 8th, 2011, 01:53
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,701
Thanks: 429
Thanked 1,757 Times in 1,456 Posts
Default

See post #10.
Reply With Quote
Reply

Tags
mbr

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Solved] MBR sent via mail in binary form Seeker General 6 September 22nd, 2011 06:51
[Solved] No MBR Installed After Boot joshdmiller Installing & Upgrading 8 August 12th, 2011 08:18
[Solved] convert OpenBSD mbr to FreeBSD mbr with FreeBSD boot manager sidney6 Installing & Upgrading 2 July 18th, 2011 23:43
FreeBSD overwrites MBR. elias Installing & Upgrading 8 June 18th, 2011 22:31
mbr lumiwa Installing & Upgrading 5 December 10th, 2009 00:16


All times are GMT +1. The time now is 08:25.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0