Skip to main content
1 of 8
AntonioK
  • 1.2k
  • 2
  • 16
  • 29

Assuming that there is 512-byte DOS-like MBR, and you have replaced first 446 bytes of it with some crap (zeros or just /dev/urandom output). In this case MBR partition table is on it's place, but system cannot boot from this device.

Idea is to use other BSD-like system's loader to boot with your device and your kernel.

  • You should start booting to any BSD-like OS (I have tried with FreeBSD 8.3, 8.4, 9.2 and Frenzy 1.4) from another HDD, CD, flash drive, PXE, virtual media via BMC/KVM, etc.
  • During boot process hit "Escape to loader prompt" option on loader screen (it would be "6" in older FreeBSD systems, "3" in FreeBSD 9, "8" in Frenzy)
  • Unload kernel and modules by typing unload
  • Find out the device you want to boot your FreeBSD from (usually something like disk0s1a) by typing lsdev
  • Set this device "current" by typing set currdev="disk0s1a"
  • Re-read loder.conf from your device (to be sure that all your kernel tunings and hacks would apply) by typing read-conf boot/loader.conf
  • Start OS and enjoy - just type boot-conf

When your OS starts, you could repair bootcode (I use sysinstall for it, but it is deprecated since 9.0-RELEASE, and there should be a bit more modern way to fix bootcode on MBR).

AntonioK
  • 1.2k
  • 2
  • 16
  • 29