zfsbootcfg: a simple tool to set next boot (one time) options for zfsboot
authoravg <avg@FreeBSD.org>
Sat, 29 Oct 2016 14:09:32 +0000 (14:09 +0000)
committeravg <avg@FreeBSD.org>
Sat, 29 Oct 2016 14:09:32 +0000 (14:09 +0000)
commitc573dff5b0503e03cf400af8bcaffebab17df3a4
treea542dc12a8746152e8972c9868e11cb4a8eb88a3
parent5ea37b9562717e30d0eb0723770d3918bfe8bbe1
zfsbootcfg: a simple tool to set next boot (one time) options for zfsboot

(gpt)zfsboot will read one-time boot directives from a special ZFS pool
area.  The area was previously described as "Boot Block Header", but
currently it is know as Pad2, marked as reserved and is zeroed out on
pool creation.  The new code interprets data in this area, if any, using
the same format as boot.config.  The area is immediately wiped out.
Failure to parse the directives results in a reboot right after the
cleanup.  Otherwise the boot sequence proceeds as usual.

zfsbootcfg writes zfsboot arguments specified on its command line to the
Pad2 area of a disk identified by vfs.zfs.boot.primary_pool and
vfs.zfs.boot.primary_vdev kenv variables that are set by loader during
boot.  Please see the manual page for more.

Thanks to all who reviewed, contributed and made suggestions!  There are
many potential improvements to the feature, please see the review for
details.

Reviewed by: wblock (docs)
Discussed with: jhb, tsoome
MFC after: 3 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D7612
15 files changed:
cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
sbin/Makefile
sbin/zfsbootcfg/Makefile [new file with mode: 0644]
sbin/zfsbootcfg/zfsbootcfg.8 [new file with mode: 0644]
sbin/zfsbootcfg/zfsbootcfg.c [new file with mode: 0644]
sys/boot/i386/common/drv.c
sys/boot/i386/common/drv.h
sys/boot/i386/gptzfsboot/Makefile
sys/boot/i386/zfsboot/Makefile
sys/boot/i386/zfsboot/zfsboot.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h