Comment 2 for bug 1639500

Revision history for this message
Sam Van den Eynde (samvde) wrote :

For the additional pools one might have, I adapted the script so it snapshots everything else.

To trigger the script I added a new service zfs-import-scan.service, and I adapted the existing zfs-mount.service to include it. This way additional zpools will be snapshotted right after being imported, and before mounting takes place. The script doing the work is called zfs-systemd-snap.

I keep both the initramfs and systemd solution in place on my systems because the rootfs has been pivoted when systemd runs and the whole goal of this is to snapshot zpools without them being written to. I did make sure not to snapshot a zpool twice.

To test the additional systemd stuff:
- add zfs-systemd-snap to /etc/systemd
- add zfs-import-scan.service to /etc/systemd/system and run "systemctl enable zfs-import-scan.service"
- add zfs-mount.service to /etc/systemd/system and run "systemctl enable zfs-mount.service"

That's basically it, it should run based on the same GRUB parameter mentioned before behaving the same way.

Disclaimer: when executing the steps above you are effectively overriding the default zfs-mount.service script provided by the Ubuntu-provided zfs packages. If the unit file gets updated in the future, this will no longer be reflected on your system.