> I believe the zed systemd unit should at the very least be modified not to start inside containers
That can be done with ConditionVirtualization=!container
> (b) there were an /etc/default/zed which enabled one to disable zed altogether.
Please don't do that. /etc/default files should never have been mis-used for enabling/disabling services -- there already is update-rc.d enable/disable for that (or the more direct systemctl enable/disable now).
> we could have a unit list "RequiresFilesystem" with "zfs" and so have zfs-zed kick in as soon as any zfs mount occurs
There is no direct way to express this; but IMHO a sufficient approximation is to start it if a zfs file system exists? That can be done with an udev rule like
> I believe the zed systemd unit should at the very least be modified not to start inside containers
That can be done with ConditionVirtua lization= !container
> (b) there were an /etc/default/zed which enabled one to disable zed altogether.
Please don't do that. /etc/default files should never have been mis-used for enabling/disabling services -- there already is update-rc.d enable/disable for that (or the more direct systemctl enable/disable now).
> we could have a unit list "RequiresFilesy stem" with "zfs" and so have zfs-zed kick in as soon as any zfs mount occurs
There is no direct way to express this; but IMHO a sufficient approximation is to start it if a zfs file system exists? That can be done with an udev rule like
ACTION!="remove", SUBSYSTEM=="block", ENV{ID_ FS_TYPE} =="zfs" , ENV{SYSTEMD_ WANTS}+ ="zed.service"
Note that I don't know the precise value of ID_FS_TYPE for zpools, and the precise name of the service you want to start.