ZFS Keep track of /etc and /usr/local with default Root-on-ZFS dataset layout

I chose Auto (ZFS) Guided Root-on-ZFS during installation for a laptop with a single disk.

  • I chose stripe since I have only one disk.
  • I selected to encrypt the boot environments with geli.
  • The installer created the default layout and datasets under zroot.

My question is, I want to keep track of the changes that I make to /etc and /usr/local.

For example, I'd like to take a snapshot of the whole system after first install, then after making some configuration changes in /etc and installing packages or after configuring X11 I want to take snapshots of /usr/local.

Is this possible? As fas as I understand by default /usr is not mounted and /etc dataset is not created by the installer.
 
Boot environments or not, you can always snapshot ZFS datasets. If you want to only snapshot a folder in a dataset without snapshotting other folders on it, you need to make a new dataset (same access permissions as the folder) and copy that folder's contents to the new dataset. Now you are ready to snapshot just that folder.

/usr should be created as its own dataset by the installer. As for not being mounted, if I see it correctly then it mounts other datasets below it but doesn't mount the <pool>/usr dataset to /usr. You can change that if you like; canmount and mounted are likely the dataset properties you want to review for that.

If you want the dataset backed up and reverted with boot environments, you likely want to place it under <pool>/ROOT/<currently active boot environment> somewhere. You also likely want to become familiar with
bectl()'s section about "deep boot environments" though "Boot Environment Structures" as a whole has good (but almost too brief) information.
 
Don't put /etc/ on a separate dataset. When the system boots only the root filesystem is mounted (read-only), after the kernel is loaded and initialized, init(8) gets started, which in turn starts running /etc/rc (rc(8)) to boot the system. This will be impossible if /etc/ isn't mounted yet.
 
Back
Top