reinstall MBR

Hi

I use FreeBSD 8.2 dual boot with winXP under VirtualBOX, I'm just training with basic commands like fdisk :stud . 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?
 
/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.
 
wblock@ said:
/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 :\
 
# 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.
 
128889Snap1.jpg

partition 1 for NTFS, 2 for FreeBSD the other disk is just additional free disk
 
wblock@ said:
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

mini_364694Snap1.jpg

don't care about this, it's just UFS free disk
 
Hanzo said:
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.
 
luckily i have backuped my my virtual disk before removing mbr and here is my original fdisk:
 
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
 
I know :D 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.
 
Back
Top