[Bug 226714] zfsboot(8) erroneously suggests creating a BSD label

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Mar 19 09:44:16 UTC 2018


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226714

Eugene Grosbein <eugen at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |avg at FreeBSD.org,
                   |                            |eugen at freebsd.org,
                   |                            |imp at FreeBSD.org
             Status|New                         |Open

--- Comment #1 from Eugene Grosbein <eugen at freebsd.org> ---
This is what happens inside: zfsboot normally reads zfsloader from active slice
containing ZFS boot pool and starts it.

zfsloader tastes all slices using zfs_probe_partition() function from
sys/boot/zfs/zfs.c that calls open(devname, O_RDONLY).

open(devname, O_RDONLY) returns -1/ENOENT for a slice that has traces of BSD
label, so zfsloader fails to find bootable ZFS pool. This is libstand's open()
call in stable/11. It returns -1 if detects "DISKMAGIC ((u_int32_t)0x82564557)
/* The disk magic number */" in the second sector of a slice.

One can use tools/tools/bootparttest to see if that is the case, for example:

disk0s2: FreeBSD                2047MB
read 512 bytes from the block 0 [+16777720]
read 512 bytes from the block 1 [+16777720]
ptable_bsdread: BSD detected
disk_close: disk0: closed => 0x801621000 [1]

In fact, disk0s2 contains ZFS boot pool and DISKMAGIC in the second sector.

Easiest fix would be to replace "dd if=/boot/zfsboot of=/dev/ada0s1 count=1"
with "dd if=/boot/zfsboot of=/dev/ada0s1 count=2" in the docs to make sure that
second sector has no traces of BSD label.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-doc mailing list