About a week ago, I was doing some HDD benchmark tests and I accidentally specified the boot drive as the source for a test. Oops. Everything was OK. Until I rebooted.
It would not boot. I figured I knew what happend. I’d munged my boot code. And I knew how to fix it. However, I didn’t realize that I’d also deleted the boot partition.
I asked on the FreeBSD dev IRC channel. db confirmed that I’d trashed my boot partition. Even with that hint, I didn’t see that the partition was gone.
Here is what the partitions looked like:
I asked for help on the FreeBSD forums (always a good source). But before that solution came in, I got advice from hrs:
[17:59]dvl: you freed freebsd-boot partition at 34 for some reason. [17:59] # gpart bootcode -b /boot/pmbr ada0 [17:59] # gpart add -b 34 -s 94 -t freebsd-boot ada0 [17:59] # gpart bootcode -p /boot/gptboot -i 1 ada0 [17:59] should restore the partition and boot block.
And he was exactly right. I owe this man a beer. Here are the commands I entered:
I also had to renumber the device within /etc/fstab, but that is outside the scope for this problem.
I rebooted and I had my system back.