Ext4 Filesystem in ZFS a pool (for Docker)
Those who’ve tried using docker’s zfs
storage driver on linux will know that it’s
not as well-supported as others. It’s decent, it works, but you can hit some limitations such
as zfs filesystems that aren’t removed correctly, or don’t exist so they can’t be removed
or k3s not working without support for overlayfs.
In my experience, it has also been quite slow and ressource-intensive.
Support for OverlayFS2 on ZFS is coming soon, but it’s not there yet. While looking for a work-around, I found out an elegant solution: use a zvol.
In short, it is possible to create any kind of filesystem (in our case: ext4) within a ZFS pool, by
exposing a ZVOL
:
So I created a zvol with an ext4 filesystem in it:
|
|
Then I stopped the docker daemon and cleaned /var/lib/docker
:
|
|
As root:
|
|
Then I mounted the filesystem. In /etc/fstab
:
|
|
Then:
|
|
Also, in my docker config (in /etc/docker/daemon.json
), I changed the storage driver:
|
|
Finally, I restarted restart docker.