Partitioning and ZFS pool layout considerations when installing FreeBSD on large-capacity 3.5-inch SAS drives

Hi everyone,

I am preparing a fresh FreeBSD installation on a storage-focused machine and wanted to get a sanity check on disk layout, boot behavior, and ZFS pool alignment before committing data to the array.

One specific point I want to ask about here is whether people prefer keeping the root OS installation on a separate small boot mirror while leaving large-capacity bulk drives strictly dedicated to a data zpool, or if installing Root-on-ZFS directly onto large enterprise drives has worked out cleanly for you across major release upgrades. With modern drive capacities climbing well past the multi-terabyte mark, an early layout decision during bsdinstall tends to stick around for years, and reshaping a pool later is rarely fun once terabytes of files are sitting on it.

In my own experience setting up and testing storage hardware—including 12TB 7.2K RPM 3.5-inch SAS 12Gbps hard drives—proper sector alignment (ashift=12), HBA pass-through (IT mode) visibility during early boot, and predictable device enumeration (da0, da1, etc. versus GPT labels) make a huge difference when you later run freebsd-update or replace a drive. In my own builds, using explicit GPT labels from day one and keeping the OS footprint cleanly separated from the main bulk storage pool has saved me plenty of second-guessing during kernel upgrades and controller swaps. At the same time, I know plenty of folks run single-pool Root-on-ZFS setups with boot environments and swear by how clean bectl rollbacks are when updating.

For those of you installing FreeBSD on systems with large 12Gbps SAS drives and HBAs, do you isolate the OS onto dedicated boot media, or do you put Root-on-ZFS directly on the big storage drives and rely on boot environments for upgrades?
 
people prefer keeping the root OS installation on a separate small boot mirror
I like doing this because the larger drives I set up will have encryption (either GELI or ZFS).

At least with the boot device I know the system will get to an ssh prompt without needing BMC access for entering encryption passphrases.

Plus I've got an easy-to-access OS "platform" for investigating any issues with the main storage - won't need rescue media or anything like that.

But sure there are many ways to do this.
 
I want to ask about here is whether people prefer keeping the root OS installation on a separate small boot mirror while leaving large-capacity bulk drives strictly dedicated to a data zpool, or if installing Root-on-ZFS directly onto large enterprise drives has worked out cleanly for you across major release upgrades.
I would recommend to add a small extra drive for boot, swap, and system, and keep the large drives in a separated pool of its own for the data you want to store.
Chosing a fast 128G or perhaps even 256G drive was by far way more than enough. My small headless (no X/Wayland, DE/WM) NAS uses less than 11G disk space plus 8G swap, so even a 32G drive could be enough.
This way: easier, less complicated, less trouble, no partitioning, more benefits, since the pool and machine/system are independent from each other.
 
Unless the idiot controller has size restrictions for boot in its BIOS there is no reason to partition.
One thing mandatorily to be needed to consider:
If an extra drive for boot purpose only is NOT prepared, partitioning for ESP (in cases of UEFI) or freebsd-boot (in cases GPT scheme on legacy BIOS) is needed to be partitioned, so ZFS pool(s) is/are needed to be in partition(s), too.

Another optional thing to be considered would be:
Drives (regardless SSD or spinning rust) stating the same capacity are NOT always have exactly same capacity, depending on models, manufacturers and at worst the lot it is manufactured could cause differences.
So researching possible minimum capacity and partitioning with the size could help when all spare drives purchased at the same time in same manufacturer, model and lot are consumed. You can partition it in same size with others already running to replace (approaching to be) dead drive(s).
 
This way: easier, less complicated, less trouble, no partitioning, more benefits, since the pool and machine/system are independent from each other.

The problem with that is that the flash device provides hardy any performance improvement beyond speeding up the boot time. L2ARC is better value for money IMO and a failed L2ARC wont stop you booting.

People cite the risk of losing data when upgrading software in a single pool, but it seems to me that the chief risk there is in reinstalling with the installer; for those of us who never do that, the risk is very low.
 
whether people prefer keeping the root OS installation on a separate small boot mirror while leaving large-capacity bulk drives strictly dedicated to a data zpool,
yes. this is the way to go for storage servers - keep the user data separated from the OS.
Use a pair of small SSD/NVMe for the OS and the whole spinning rust disks for the storage pool and add mirrored "special" devices also on SSD/NVMe if that pool needs to serve e.g. network file shares that require somewhat reasonable IOPS.
As for disk naming: *always* use labels as the raw device names can always change. IMHO a good naming convention includes the last few digits of a drives serial number, so there is a direct correlation between the name and whan can be physically found on the disk (e.g. to double-check when replacing a failed disk).


Using a distinct storage pool also makes it trivial to transfer a pool to another server e.g. in case of hardware failure or upgrade/migration - you can prepare the new machine with a new installation (or from backup/via snapshots from the old server) and after verifying everything works, move the user data by physically moving the disks during your maintenance window.
 
yes. this is the way to go for storage servers - keep the user data separated from the OS.

I can see two reason for separating data and OS. One is where you have multiple OSs on the boot disk, the other is where the OS is updated with images files. In the case where the OS is updated with pkg, freebsd-update etc, what do you see as the advantage?
 
No sane person would put multiple OS on a production host...

The biggest advantage, as I already wrote, is easy migration of user data, e.g. in case of a system failure or upgrade - prepare the new host, get everything up and running, then move over the data pool that holds the production user data.
It's been standard practice since forever to use (usually a mirror) of smaller disks (SSDs) for the OS and put the actual production/user data on a distinct pool of disks. This pool can then be optimized for the actual workload and load on that pool doesn't interfere with the OS (or vice versa).
 
No sane person would put multiple OS on a production host...
Consumers who want to try multiple OS'es but cannot have multiple computers would do on their "personal production" host. 😁

But it's strongly adviced to have multiple physical drives (regardless they're SSD or spinning rust) and install one OS per physical drive.
 
No sane person would put multiple OS on a production host...

The biggest advantage, as I already wrote, is easy migration of user data, e.g. in case of a system failure or upgrade - prepare the new host, get everything up and running, then move over the data pool that holds the production user data.
It's been standard practice since forever to use (usually a mirror) of smaller disks (SSDs) for the OS and put the actual production/user data on a distinct pool of disks. This pool can then be optimized for the actual workload and load on that pool doesn't interfere with the OS (or vice versa).
Not everyone on this forum works in a data centre, and cargo-culting those practices is not always sensible. The reason I mentioned multiple booting is that separating OS and data is then essential and I think that clouds some people's judgment.

The advantages you mentioned aren't always useful. If you have a system failure with a single pool, most of us would just move the drives to new hardware. If the pool is corrupted you have to restore from backup either way.

It used to be the case that disk caching was all MRU; but with MFU caching in ARC and larger memory sizes, tuning the OS separately should be much less useful, as is having it on fast storage.
 
I have recently installed several multi-terabyte servers from HPE, Fujitsu and DELL recently. This is how I went with disks:
* two disks for `zroot` mirror, both with ESP and swap partition (not mirrored), full boot code, no explict boot entry in NVRAM since it would require two anyway and gives me no benefit over the generic entry in the UEFI boot menu
* Data pool `{manufacturer}-data` raidzX directly on disks, no GPT

Here the important part: Do not operate on device names, they can always change.

From my internal documentation:
.Preinstallation
====
In the FreeBSD boot menu escape to loader prompt and type:
....
set kern.geom.label.gptid.enable="1"
set kern.geom.label.disk_ident.enable="1"
boot
....
====

.Postinstallation
====
Drop to the interactive shell and perform the following steps:
....
# sed -i '' '/kern\.geom\.label\.gptid\.enable/d' /boot/loader.conf
# sed -i '' '/kern\.geom\.label\.disk_ident\.enable/d' /boot/loader.conf
# cp /etc/fstab /etc/fstab.bak
## Use GPT labels instead of raw partitions
# sed -i '' 's|/dev/da0p2|/dev/gpt/swap0|' /etc/fstab
# sed -i '' 's|/dev/da1p2|/dev/gpt/swap1|' /etc/fstab
# umount -f /mnt/dev
## Session is dropped, relogin
# zpool export zroot
# zpool import -d /dev/gpt/zfs0 -d /dev/gpt/zfs1 -R /mnt zroot
....
====
Perform the following basic steps:

.Filesystems
* Create additional `zroot` datasets:
+
....
# zfs create zroot/usr/obj
# zfs create zroot/usr/local
....
* Create zpools:
+
....
# zpool create -m none hpe-data raidz2 \
/dev/diskid/DISK-WB... /dev/diskid/DISK-WB... \
/dev/diskid/DISK-WB... /dev/diskid/DISK-WB... \
/dev/diskid/DISK-WB... /dev/diskid/DISK-WB...
....
+
with configuration:
+
....
# zfs set compression=on zroot hpe-data
# zfs set atime=off hpe-data
....
* Limit ZFS ARC size by adding to `/boot/loader.conf`:
+
....
vfs.zfs.arc.max="16G"
....

Reboot the system.


Document your disks in a spreadsheet:
** Columns: `"Enclosure ID"`, `"Slot ID"`, `"Device ID"`, `"Vendor"`, `"Model"`, `"Serial No."`, `"Disk Ident"` (as created by `glabel(8)`) `"Capacity (GB)"`, `"Speed"`, `"FreeBSD Device"`, `"ZPool"`,
** FreeBSD devices as identified by `mrsas(4)`,
** the zpool disks that are member.

Adapt to your setup.
 
Not everyone on this forum works in a data centre, and cargo-culting those practices is not always sensible. The reason I mentioned multiple booting is that separating OS and data is then essential and I think that clouds some people's judgment.

You don't need to have a "data center" for having more than one drive in a machine.
I'm not talking laptops. Those provide one or two drive ports at most: 1x NVMe, 1x SATA. Those are secondary machines for travelling. Unless somebody is almost always en route I would never use a laptop as my primary or only computer, pay more money for a lesser computer, to get an almost not re-configurable machine with a small screen, a keyboard that sucks, just to have a portable machine leashed fixed to the same place instead of a real computer that is meant for being stationary offering more power and options for less money.
On my laptop is one OS installed, only. The one I decided to be my primary production one (FreeBSD), being a copy of my desktop (or just as a terminal to ssh into the main machine) for when I'm en route. There are others in VMs as guests, but not as hosts sharing the same storage.

A common ATX mainboard comes with at least 4 SATA ports, often more, plus at least 1, if not 2 M.2 ports for NVMe drives. Plus the possibility to install PCIe cards for a couple of bucks each adding more ports for even more drives. Plus more USB ports before fumbling with hubs. That gives enough possibilities to have each OS and the data on separate drives or pools. I wouldn't call that a "data center". I call that a computer. 😎
Chose a real computer, and you can easily and quickly install or replace as many drives as you want, get more power, more options, and fewer trade-offs as what you get with a laptop for the same price.

If you have some value on your production driver you don't risk to install an OS on the same drive. I have too many bad experiences with installations above all but not only Microsoft's "Operating Systems". Once even one of the more popular Linux distros hogged my entire drive killing my main production driver without asking. I don't risk that anymore. Doesn't matter if you have backups. Of course you have BUs. But I don't risk hours of unneccessary, easy to avoid restoring when there are live systems, VMs/hypervisors, and you can get a 1T HDD for less than 20 €. Even ten years ago, when I still used Windows as my primary OS, I had a second OS (Linux) installed mostly for maintaining my Windows, I had them on separate drives. And I simply used BIOS' boot options to start instead of a bootloader. I rather add or exchange drives than tinker with partitions, fumble with bootloaders, and junk. Way too risky, and not worth the effort.
  • You keep different OSs on separate drives, even better different machines.
  • You keep your data separated from your OS(s).
  • You do backups at least on other, own separate drives, better pools with redundant drives on another machine.
Or you don't have anything of value.
 
Back
Top