personal web log written by izabeera and dryobates

boot freebsd boot0cfg slice

Disable slice in FreeBSD

by dryobates

HP recovery partition on Compaq 6720s has some unwanted behavior: it overwrites boot manager if accidentaly run.

In my notebook I have dual boot: Windows and FreeBSD. I use FreeBSD boot manager to choose which one start. This manager by default shows all primary partitions. I have all four (I still use MBR/LBA instead of modern GPT [1]).

My boot menu looks like that:

F1 Win
F2 Win
F3 ??
F4 FreeBSD

F1 is my Windows partition. F2 is recovery disk. Once I accidentally pressed F2 and had to restore FreeBSD boot manager from FreeBSD live cd like this:

fdisk -B -b /boot/boot0 /dev/ada0

(ada0 is my disk from which system starts).

As it’s easy to make mistake and press wrong key I thought I’ll disable not used ones (“Prevention is better then cure”):

boot0cfg -m 0x9 ada0

I used mask 0x9, because I want only F1 (bit nr 0 set) and F4 (bit nr 3 set) to be enabled:

$ dc -e '2i 1001p'
9

Now I wont make mistake:

F1 Win
F4 FreeBSD

And if I would like to run software from recovery disk I can press F9 during normal Windows boot (it still works) or enable partition again from FreeBSD:

boot0cfg -m 0xf ada0
[1]GUID Partition Table: http://en.wikipedia.org/wiki/GUID_Partition_Table
dryobates
dryobates
Jakub Stolarski. Software engineer. I work professionally as programmer since 2005. Speeding up software development with Test Driven Development, task automation and optimization for performance are things that focus my mind from my early career up to now. If you ask me for my religion: Python, Vim and FreeBSD are my trinity ;) Email: jakub@stolarscy.com

Archive

Tag cloud