Posts tagged: zfs

All posts with the tag "zfs"

15 posts latest post 2026-10-06
Publishing rhythm
Oct 2026 | 1 posts

Benchmark your disks with fio

Intro I use ZFS at home in my homelab for basically all of my storage… Docker uses ZFS backend, all my VMs have their images in their own zfs datasets, and all my shares are ZFS datasets. I love ZFS but my home hardware presently is the opposite of expensive or new… Thankfully I’ve had a lot of my orginal homelab simply given to me but the cost of this is that I didn’t put my machines together, I didn’t choose the disks, and I definitely didn’t do the research I would’ve otherwise done had I bankrolled my server personally… The Problem # I run on basically all my machines and for the longest time I have been seeing big time issues. Now, since everything was free I’ve largely been able to ignore that however I’m now after some better performance which I think means new hardware! Here is a random screenshot of my glances homepage at time of writing - The only major load on my server is some transcoding (about 60% CPU utilization)… As you can see… there’s a lot of issues and I don’t even…

zfs allow -u $USER clone,load-key,create,destroy,mount,mountpoint,receive,send,rollback,compression,snapshot,hold,keylocation,bookmark tank

load-key only needed if using encrypted datasets

Self-hosted Docker registry with proxy pull through

I decided that I want to self-host all my docker images for the purposes of regularly rebuilding and security scanning. The first step is to set up a registry, which coincidently enough you can do with a Docker container 😛! Instructions for setting up the proxy are on the offidical docker docs here Deployment I chose to deploy with Portainer because I already use it for monitoring all my docker containers. I deploy most container with Ansible but use Portainer to setup a few more adhoc or non-git driven applications.

TL;DR

As the nextcloud docs say… if you want to write to an external volume that location has to be writeable by the user/group www-data on the host system… so if that makes sense to you then this TIL probably isn’t a ton of value.. if not however, read on :)

Case Study

You want to self-host your own cloud and use a smart file system for convenience… Nextcloud and ZFS are pretty common goto answers for each of those problems.

My home NAS is built on ZFS and among other things I have a zpool named tank and nested in there is a tank/nas dataset with several child zfs datasets under that.

I want to use nextcloud mainly for auto-uploading photos from my wife’s and my phones for automatic backups. The issue is that the nextcloud application (I run in Docker) is fixed as the www-data user and so any volume/folder that you want nextcloud to write to needs to be permissioned such that www-data owns it… but I don’t want www-data to own everything in my NAS… so what’s a girl to do?

Solution

Well, one way to go is to just utilize docker volumes, write the data in the container to /var/www/html and let that be the place your data backsup to.

I still wanted nextcloud to automatically write right to my NAS so I created a nextcloud-upload directory inside of tank/nas/media/photos (photos cause that’s all that gets automatically uploaded)

Then I chown -R www-data:www-data /tank/nas/media/photos/nextcloud-upload so that just that sub-folder is owned by www-data. Now everyone’s happy!

As I was cleaning up my NAS recently I noticed that I ran out of storage even though my disk usage looked pretty low… turns out I was keeping a mega-ton of ZFS snapshots and due to my own ignorance at the time didn’t realize the storage cost of this!

zfs list-o space tank/home will show the disk usage of the dataset and snapshots in tank/home

I started my homelab journey being super naive about ZFS and how to manage the filesystem… that bit me in the butt when transfering a ton of files out of folders and into datasets because ZFS is copy on write so I was essentially duplicating my storage until I got a hair smarter about removing files after they’re moved (rsync –remove-source-file ftw). But I had a ton of snapshots of child datasets with a ton of data that I just never will need, so I learned zfs list -H -o name -t snapshot tank/dataset1/dataset2 will list just the snapshots for dataset2 and if you pipe that into xargs -n1 zfs destroy then you have a way to clear out some snapshots you don’t need!