8

I use ZFS to store my data, including configuration files, for my desktop PC, so it's important for my datasets to mount automatically on boot. I couldn't for the life of me figure out how to do this in Ubuntu 19.10.

At first, when I ran zfs list and zpool list, there was no output; it was empty. Then, after figuring out how to import my pools, they still wouldn't mount.

2 Answers2

4

The correct way to do this is to make sure three unit files are enabled to start on boot:

  • zfs.target, which is the overarching target for all of ZFS
  • zfs-import.service, which imports zpools at boot
  • zfs-mount.service, which mounts all datasets at boot

These units have dependencies set up correctly, so you can simply run:

systemctl enable zfs.target zfs-import.service zfs-mount.service

to ensure they are all turned on. After this, reboot to test; your ZFS datasets should show up.

1

I have found that zfs-zed.service which updates zpool cache and zfs-list cache to no longer be running after a systemctl suspend and require manual restart, if I forget that the caches don't get updated for any later changes for next reboot. I'll improve this with details shortly to replicate and try a clean install on the weekend and or move this to the to the proper place. Openzfs 2.1.5 with compatibility set to openzfs-2.1-linux. Ubuntu 22.04 and proxmox hacked with zsys sharing boot and root pools.