bootcode for ZFS

Looking at this ZFS install guide I can't quite understand what is the rationale behind:
  1. creating a pool
  2. exporting it
  3. copying the bootcode with dd(1) instead of gpart(8)
  4. importing the pool back again
My question is why this can't be accomplished with gpart bootcode -p ...?
It has surely to do with the ZFS meta data on the start of the slice but I would like to know the details, which are missing in the guide.

Thanks in advance for every hint!
 
Are you by chance looking at the now obsolete ZFS on MBR partitioned disks guide? When using GPT partitions there is absolutely no need to use dd(1) to install the bootcode.
 
Unfortunately I own an obsolete Dell laptop which refuses to boot from a GPT partitioned disk. Besides the practical usefulness of the guide I am still curious about this dd(1) hack.
 
I think it is done that way because there is no room for the bootcode otherwise. There is a small area at the beginning of the space taken by the ZFS partition that is not going to be written over and the bootcode fits there.
 
As far as I understand it, you should be able to use a GPT partitioned disk with a BIOS that is not GPT aware. /boot/pmbr should be copied to the MBR, which is a special MBR that understands the GPT scheme and searches for the first freebsd-boot GTP partition where it loads the second stage loader from.

The BIOS only sees a MBR with one big partition spanning the whole disk.
 
Re:

kpa said:
... now obsolete ZFS on MBR partitioned disks ...
Why do you say ZFS on MBR is obsolete when FreeBSD-10.0 supports MBR schemed disks as an option when doing ZFS on root installations? I have to run MBR because it's the only way FreeBSD will boot as the only OS on my iMac.

And if you have an MBR partition scheme, updating the boot code absolutely requires the use of dd(1):
Code:
# Install boot Manager (required on first install)
gpart bootcode -b /boot/boot0 ad0

# Install ZFS boot1 stage
sysctl kern.geom.debugflags=0x10
dd if=/boot/zfsboot of=/dev/ada0s1 count=1
--or--
# dd if=/boot/zfsboot of=/tmp/zfsboot1 count=1
# gpart bootcode -b /tmp/zfsboot1 /dev/ada0s1

# Install ZFS boot2 stage
# dd if=/boot/zfsboot of=/dev/ada0s1a skip=1 seek=1024
This procedure is courtesy of Scot Hetzel on freebsd-current@freebsd.org.
 
Back
Top