Root on ZFS - Boot partition on USB

I'm currently using nas4free NAS4Free, and I want to migrate to running a simple FreeBSD server. nas4free NAS4Free runs off a USB drive and my data is stored on hard disks formatted for ZFS (using the whole drive). I think it should be possible to install the /boot/ partition to the USB drive and have it mount the ZFS pool and load root from ZFS. Is that right? Is there a guide on how to do this?

Or would it just be simpler to install root on the USB drive?

Thank you,

John P.
 
FreeBSD needs to boot from a root partition containing /boot, not from a separate /boot partition. The latter is a Linux thing.

Having said that, it should be perfectly possible to put a boot partition (i.e. a root partition containing /boot) onto a USB drive and have it (re)mount a ZFS root partition. I have very limited experience with ZFS, but it probably operates on pretty much the same principle as a geli(8)-encrypted root partition, a setup I use frequently.

To illustrate, here's how the latter works on my laptop. In order to boot, I must insert a removable USB flash drive before powering on the machine. This flash drive contains a plaintext FreeBSD partition to boot from, which acts as a temporary root partition. It contains /boot, some encryption stuff (I'm too lazy to type passphrases so I use keyfiles) and nothing else. The file /boot/loader.conf contains (among other things) the line
Code:
vfs.root.mountfrom="ufs:/dev/label/root"
which instructs the system to mount /dev/label/root as the root filesystem. This is the actual root partition, residing inside a GELI encryption container on the hard drive, which has been encrypted entirely. Once the system has finished booting (or actually at some point during the boot process, but never mind that) the USB flash drive I had to boot from can be removed, without having to unmount it first.

I'm sure a similar setup is possible with ZFS instead of (or even alongside) encryption. Have you checked the Howtos & FAQs section of this forum? Surely there must be a tutorial there for the setup you desire.
 
drakanious said:
Wow! Thanks for such a great reply.
You're welcome.

There are plenty of ZFS-related tutorials in the "Howtos & FAQs" section and even GELI tutorials might be at least partially helpful. However, it's possible that the setup you wish takes some manual labour (i.e. you might have to do some things manually rather than simply running the installer, not unlike an old-school Slackware Linux install). If you get stuck, by all means feel free to call back here. Your query doesn't seem weird at all, so surely someone else has already done it.
 
Back
Top