Index: usr.sbin/bsdinstall/bsdinstall.8 =================================================================== --- usr.sbin/bsdinstall/bsdinstall.8 +++ usr.sbin/bsdinstall/bsdinstall.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 23, 2017 +.Dd February 05, 2018 .Dt BSDINSTALL 8 .Os .Sh NAME @@ -310,6 +310,100 @@ If this directory does not already exist, it will be created. Default: .Pa /tmp/bsdinstall_boot +.It Ev ZFSBOOT_POOL_NAME +Name for the pool containing the base system. +Default: zroot +.It Ev ZFSBOOT_POOL_CREATE_OPTIONS +Options to be used when creating the base system's pool. +Each option must be followed by the -O flag to be taken into consideration +or the pool will not be created due to errors using the command +.Cm zpool . +Default: -O compress=lz4 -O atime=off +.It Ev ZFSBOOT_BEROOT_NAME +Name for the boot environment parent dataset. +This is a non-mountable dataset meant to be a parent dataset where different +boot environment are going to be created. +Default: ROOT +.It Ev ZFSBOOT_BOOTFS_NAME +Name for the primary boot environment, which will be the default boot +environment for the system. +Default: default +.It Ev ZFSBOOT_VDEV_TYPE +The type of pool to be created for the base system. +This variable can take one of this values: stripe (No redundacy), +mirror (n-Way mirroring), raid10 (RAID 1+0 - n x 2-Way Mirrors), +raidz1 (RAID-Z1 - Single Redundacy RAID), raidz2 (RAID-Z2 - Double Redundacy RAID) +or raidz3 (RAID-Z3 Triple Redundacy RAID). +Default: stripe +.It Ev ZFSBOOT_FORCE_4K_SECTORS +Indicates either the pool will use 4K or 512 sectors. +If this variable is not empty, 4K sectors will be used. +Default: 1 +.It Ev ZFSBOOT_GELI_ENCRYPTION +If this variable is not empty, it will use +.Xr geli 8 +to encrypt the root pool, enabling automatically the +.Ev ZFSBOOT_BOOT_POOL +variable. +Default: "" +.It Ev ZFSBOOT_GELI_KEY_FILE +Path to the +.Xr geli 8 +keyfile used to encrypt the pool where the base system is stored. +Default: +.Pa /boot/encryption.key +.It Ev ZFSBOOT_BOOT_POOL +If set a separated boot pool will be created for the kernel of the +system and +.Xr loader 8 . +Default: "" +.It Ev ZFSBOOT_BOOT_POOL_CREATE_OPTIONS +Options to use when creating the boot pool, when enabled (See +.Ev ZFSBOOT_BOOT_POOL ). +Default: "" +.It Ev ZFSBOOT_BOOT_POOL_NAME +Name for the optional boot pool when it is enabled, (See +.Ev ZFSBOOT_BOOT_POOL ). +Default: bootpool +.It Ev ZFSBOOT_BOOT_POOL_SIZE +Size of the boot pool when it is enabled (See +.Ev ZFSBOOT_BOOT_POOL ). +Default: 2g +.It Ev ZFSBOOT_DISKS +Disks to be used for the base system, including the boot pool. +This variable must only be used on a scripted installation. +See +.Sx SCRIPTING +for more information. +Default: "" +.It Ev ZFSBOOT_SWAP_SIZE +Size of the swap partition on each block device. +This variable will be passed to +.Xr gpart 8 ; +which supports SI unit suffixes. +Default: 2g +.It Ev ZFSBOOT_SWAP_ENCRYPTION +If set, enables the encryption of the swap partition using +.Xr geli 8 . +Defaulf: "" +.It Ev ZFSBOOT_SWAP_MIRROR +If set, enables a swap mirroring using +.Xr gmirror 8 . +Default: "" +.It Ev ZFSBOOT_DATASETS +ZFS datasets to be created on the root zpool, it requires the +following datasets: +.Pa /tmp , +.Pa /var/tmp , +.Pa /$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME . +See +.Sx ZFS DATASETS +for more information about who to write this variable and to +take a look into the default value of it. +.It Ev ZFSBOOT_CONFIRM_LAYOUT +If set and the installation is interactive, allow the user to confirm +the layout before continuing with the installation. +Default: 1 .El .Sh SCRIPTING .Nm @@ -338,6 +432,19 @@ pkg install puppet .Ed .Pp +For a ZFS scripted installation, the script looks like this: +.Bd -literal -offset indent +DISTRIBUTIONS="kernel.txz base.txz" +export ZFSBOOT_VDEV_TYPE=stripe +export ZFSBOOT_DISKS=ada0 +export nonInteractive="YES" + +#!/bin/sh +echo "ifconfig_em0=DHCP" >> /etc/rc.conf +echo "sshd_enable=YES" >> /etc/rc.conf +pkg install puppet +.Ed +.Pp On .Fx release media, such a script placed at @@ -374,7 +481,21 @@ the preamble can contain the variable .Ev ZFSBOOT_DATASETS instead of -.Ev PARTITIONS . +.Ev PARTITIONS , +and setting the variables +.Ev ZFSBOOT_DISKS +and +.Ev ZFSBOOT_VDEV_TYPE +to create the pool of disks for the base system. +Usually, for a mirrored booting disk, this two variables looks like this: +.Bd -literal -offset indent +ZFSBOOT_DISKS="ada0 ada1" +ZFSBOOT_VDEV_TYPE=mirror +.Ed +.Pp +Remenber to export all the variables for the +.Cm zfsboot +command, otherwise it will not get set. .Ss SETUP SCRIPT Following the preamble is an optional shell script, beginning with a #! declaration. @@ -385,6 +506,52 @@ Note that newly configured system services, e.g., networking have not been started in the installed system at this time and only installation host services are available. +.Ss ZFS DATASETS +The +.Cm zfsboot +partitioning takes the +.Ev ZFSBOOT_DATASETS +variable to create the datasets on the base system. +This variable can get pretty huge if the pool contains a lot of datasets. +The default value of the +.Ev ZFSBOOT_DATASETS +looks like this: +.Bd -literal -offset indent +# DATASET OPTIONS (comma or space separated; or both) + +# Boot Environment [BE] root and default boot dataset +/$ZFSBOOT_BEROOT_NAME mountpoint=none +/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME mountpoint=/ + +# Compress /tmp, allow exec but not setuid +/tmp mountpoint=/tmp,exec=on,setuid=off + +# Do not mount /usr so that 'base' files go to the BEROOT +/usr mountpoint=/usr,canmount=off + +# Home directories separated so they are common to all BEs +/usr/home # NB: /home is a symlink to /usr/home + +# Ports tree +/usr/ports setuid=off + +# Source tree (compressed) +/usr/src + +# Create /var and friends +/var mountpoint=/var,canmount=off +/var/audit exec=off,setuid=off +/var/crash exec=off,setuid=off +/var/log exec=off,setuid=off +/var/mail atime=on +/var/tmp setuid=off +.Ed +.Pp +The first column if the dataset to be created on the top of the +.Ev ZFSBOOT_POOL_NAME +and the rest of the columns are the options to be set on each dataset. +The options must be written on a coma or space separated list, or both. +And everything behind a pound/hash character is ignored as a comment. .Sh HISTORY This version of .Nm