Expanding a GELI-encrypted ZFS pool
My personal FreeBSD 11.3 server (VPS) was running low on storage space.
By using the VPS provider’s disk expansion option, I could easily grow the virtual disk.
But then I wondered how to expand the filesystem on it.
In my case, the filesystem is on a GELI-encrypted ZFS storage pool.
So I had to resize the following entities.
GPT freebsd-zfs partition GELI device on the GPT partition ZFS pool comprised of the GELI device After rehearsing on VirtualBox VMs, I took the following steps to get more free space for the server.
Growing a ZFS Mirror Pool
I have a tiny home server for my family. It’s based on Atom N2800 CPU and runs FreeBSD 11.2 with a two-disk ZFS mirror.
Originally it had two 500GB disks, but now it has a 500GB and a 1TB ones because one of them was replaced due to a failure.
As the Handbook says, the available space of a mirror pool is limited by the size of the smallest disk. So my server can still get only 500GB from the total space of 1.
Mounting ZFS Root failed when an external USB drive is connected
Last week, one of my FreeBSD 11.2 servers failed to boot with the following error after freebsd-update.
Mounting from zfs:zroot/ROOT/default failed with error 6; retrying for 3 more seconds It was the first time I encountered this type of error.
After struggling for some hours, I was able to boot the server by disconnecting an external USB harddrive, which I had prepared as a secondary backup storage. But since then, I had been wondering what the root cause was.
Encrypted Temporary Storage with GELI
Recently, I wanted an encrypted working directory on a running FreeBSD system. The system was running on a plain (unencrypted) ZFS pool and there’s no plan to add disks to it. I needed the working directory only temporarily.
I came up with the following options.
Use GELI on a ZFS volume (zvol). Use GELI on a memory disk (md). Use PEFS on a directory. I excluded PEFS because I had very little experience.
Migrating a live system from GEOM mirror to ZFS mirror
I had been wanting to migrate a FreeBSD system on a GEOM mirror (gmirror) to a ZFS mirror.
After several rehearsals on a VM, I have finally achieved that goal with the following steps.
Load ZFS-releated kernel modules and set a tunable to use 4K sector drives.
sudo kldload zfs sudo sysctl vfs.zfs.min_auto_ashift=12 Remove one (da0) of the two disks (da0, da1) which make up the gmirror (gm0).