Guides that discuss using ZFS with MySQL / MariaDB always say you should create a directory to hold the MySQL data with recordsize=16k, to match MySQL’s block size.
I’ve created a Debian container with LXD and would like to run MySQL inside it, but the recordsize of the container in the ZFS pool is just at the default 128k. I would like to create another ZFS filesystem to just hold the MySQL data, so I can set that filesystem to have recordsize=16k.
I’m wondering what is the best practice way to do this with LXD?
Do I need to create a ZFS filesystem outside LXD’s ZFS dataset and share it with the container? Something like:
zfs create -p rpool/extracontainerdata/mycontainer/mysql/data
zfs set recordsize=16k rpool/extracontainerdata/mycontainer/mysql/data
lxc config device add mycontainer mysqldata disk source=/extracontainerdata/mycontainer/mysql/data path=/var/lib/mysql/data/
echo -en “uid 117 106\ngid 124 110” | lxc config set mycontainer raw.idmap -
It seems like this should work but seems a little clunky as this extra ZFS dataset lives outside the dataset that LXD manages. Is there a better way to do this where I can create the device so LXD itself manages it, just like it currently does with the main root filesystem for this container? Thanks.