Solved I lost bootcode in BSD slice, a lot. Help me found out WHY?

I read the zfsboot(8) example again, should I use

Bash:
gpart bootcode -b /boot/boot0 ada0
gpart set -a active -i 1 ada0
dd if=/dev/zero of=/dev/ada0s4 count=2
dd if=/boot/zfsboot of=/dev/ada0s4 count=1
dd if=/boot/zfsboot of=/dev/ada0s4 iseek=1 oseek=1024

to reinstall boot code to ada0s4? The example does not really fits my partition scheme because I have a swap partition in ada0s4.

This is how I install bootcode normally (AFAIK this is the recommended way, I copied it initially from the Handbook or some other docu):
Bash:
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 3 ada0
Be careful about the partition number where you want to install it.
In general I create a separate partition specially for the boot code. Size: 512kB, type: freebsd-boot.

Note that I use gptzfsboot and not zfsboot like in your code. I believe the first one is when using a GPT partition table and gpart, and the second one is for MBR + fdisk.
 
Just think this might be relevant when I read the Absolute FreeBSD, 3rd Edition: The Complete Guide to FreeBSD 3rd Edition by Michael W. Lucas (which by the way is a great book!), Chapter 10 Section 10 BSD Labels :
On a traditional BSD label, the a partition is for the root filesystem, while b is for swap. The c partition represents the entire slice. This isn’t mandatory, but I recommend not using any of these letters for any other purpose...
Don’t bother fighting these traditions, especially on a decreasingly common disk format. Don’t use the letters a, b, or c for partitions other than those decreed by the Berkeley elders...
 
Top