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
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.