This tutorial by user kunst1080 shows us how to get an FreeBSD automatic installation set up using bsdinstall. *Note that this is a translated article.
Now, we take a look at how to install to ZFS using bsdinstall.
Installation of ZFS in an auto layout
As it is described in the manual, to the first half (PREAMBLE), if describe the environment variable “ZFSBOOT_DISKS” instead of “PARTITIONS”, ZFS allows you to install to.
However, care must be taken of the following two points.
- If you want to automatically install, set environment variable “nonInteractive”.
- It needs to be export environment variables “ZFSBOOT_DISKS” and “nonInteractive”.
In particular, care must be taken with regard to the second point.
(I tried to read freebsd/script at master · freebsd/freebsd · GitHub, I am feeling that because DISTRIBUTIONS has been export, but such ZFSBOOT_DISKS has not been export, …… and it is the cause)
First half (PREAMBLE)
export ZFSBOOT_DISKS=ada0 export nonInteractive="YES" DISTRIBUTIONS="base.txz kernel.txz"
In the above configuration, ZFS partition has been created by default setting.
- Device type?stripe
- Pool name?zroot
- Partition scheme?GPT
- Swap size?2G
- Mount pointszroot none zroot/ROOT none zroot/ROOT/default / zroot/tmp /tmp zroot/usr /usr zroot/usr/home /usr/home zroot/usr/ports /usr/home zroot/usr/src /usr/home zroot/var /var zroot/var/crash /var/crash zroot/var/log /var/log zroot/var/mail /var/mail zroot/var/tmp /var/tmp
Installation of ZFS in a custom layout
Set environment variable “ZFSBOOT_DATASETS”, it seems that you can create a ZFS layout freely.
For now, we will try to split /, /tmp, /usr, /var.
First half (PREAMBLE)export ZFSBOOT_DISKS=ada0 export ZFSBOOT_DATASETS=" /ROOT mountpoint=none /ROOT/default mountpoint=/ /tmp mountpoint=/tmp,exec=on,setuid=off /usr mountpoint=/usr,canmount=off /var mountpoint=/var,canmount=off " export nonInteractive="YES" DISTRIBUTIONS="base.txz kernel.txz"
In the above configuration, ZFS partition has been created with the following settings.
- Mount pointszroot none zroot/ROOT none zroot/ROOT/default / zroot/tmp /tmp zroot/usr /usr zroot/var /var
?At the time of automatic installation ZFS more information on setting, I think that it is better to check source code of the zfsboot (freebsd/zfsboot at master · freebsd/freebsd · GitHub).