# RootOnZFS - Confusion about the installation section ...



## absduser (Jul 12, 2019)

I would like to run my system on a zpool mirror as the root device.  Probably using FreeBSD 11.3-RELEASE.

This document makes good sense and I am following it:



			RootOnZFS/GPTZFSBoot/Mirror - FreeBSD Wiki
		


... until it gets to section 2:  "Installing FreeBSD to the ZFS filesystem" ... where they are manually creating the entire filesystem with "zfs create" commands and (weirdly) making individual filesystems for /var/crash, /var/db, /var/db/pkg ... and on and on ...

And then they manually unpack the whole system:

for dir in base catpages dict doc games info lib32 manpages ports; \
          do (cd $dir ; ./install.sh) ; done

Two things I don't understand:

1) why are they making so many individual filesystems with 'zfs create' for every little dir in /var and also /usr/ports, /usr/ports/distfiles, etc. ?

2) Why are they manually installing the system instead of just jumping back out and finishing with plain old sysinstall ?  The filesystems are already up and mounted so ... why can't sysinstall just finish the job ?

Thanks.


----------



## recluce (Jul 12, 2019)

There is really no need to do this. The FreeBSD installer will do all that for you, simply follow the instructions to install FreeBSD on zroot.


----------



## xtremae (Jul 12, 2019)

absduser said:


> Two things I don't understand:
> 
> 1) why are they making so many individual filesystems with 'zfs create' for every little dir in /var and also /usr/ports, /usr/ports/distfiles, etc. ?
> 
> 2) Why are they manually installing the system instead of just jumping back out and finishing with plain old sysinstall ? The filesystems are already up and mounted so ... why can't sysinstall just finish the job ?



1) They create a single filesystem with `zpool create zroot mirror /dev/gpt/disk0 /dev/gpt/disk1` which they then populate with multiple datasets (using zfs create) according to the designated use. ZFS integrates volume management which allows each dataset to be mounted with specific properties and mount options. Those (options) can be specified during dataset creation as arguments to the zfs create subcommand. This `zfs create -o compression=off   -o exec=off     -o setuid=off   zroot/usr/ports/distfiles` improves performance as it disables compression heuristics (distfiles are almost always compressed) and improves security by setting the exec and setuid bits to off.

2) It appears to be more of a detailed guide as opposed to a screenshot gallery. Although I haven't tried it myself, I suppose you can bail out of the shell and finish things off using bsdinstall(8).


----------



## aswell (Jul 12, 2019)

absduser said:


> 2) Why are they manually installing the system instead of just jumping back out and finishing with plain old sysinstall ?  The filesystems are already up and mounted so ... why can't sysinstall just finish the job ?



I attempted to do something similar, following another wiki entry: https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot  However, it failed at step 3B, and am now looking for an alternate route...

You probably can get sysinstall to finish the job, with a little testing.


----------



## aswell (Jul 17, 2019)

For future reference, https://wiki.freebsd.org/RootOnZFS/GPTZFSBoot has been updated, and now produces the desired end result.

You can use the FreeBSD installer to start an installation, drop to a Shell to partition your disk(s) the way you like, create zfs datasets with the options and mountpoints you like, then exit back into the installer and let it finish the job...


----------

