-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: better import integration with systemd, hotplug et al. #4178
Comments
@Lalufu @ryao @don-brady @ColinIanKing @adilger I'm definitely supportive of better integration with systemd. What we have now is a nice first step but it can certainly be refined. We need to have a discussion with the systemd experts, zfs experts and interested parties from the distributions and agree on a solid design for how it should be on Linux. And while I think we could use some ideas from Illumos, like the cache file, I don't think we should be constrained by them. We want it to cleanly integrate with Linux and that means taking advantage of udev, libblkid, systemd, etc. Let's try and hash out a rough design for how this could work. I'm not a systemd expert but I can definitely shed some light on what functionality exists in ZFS on Linux today which could be useful. Let me start with @intelfx comments.
I like this idea and I don't see why it wouldn't be workable. The hardest part would be the filtering but we already have most of the pieces. Udev will identify individual vdev members of a pool and update blkid accordingly, and the
While it's historically not the ZFS way you can add filesystems to the /etc/fstab. Just use as the identifier the pool/dataset name and the
This partially exists today. You can pass in any vdev member block device and it will use that to mount the pools root dataset. It would be fairly straight forward to extend that to optionally take a dataset name as well. It's just a matter of syntax and if btrfs has already established a precedent for this so much the better.
From what I can tell many people are interested in having this work smoothly. It would be great if we could get a few people to volunteer to work out a good design and implement it. |
Sure, I understand that one can write Here is how it looks for btrfs: https://github.com/systemd/systemd/blob/master/rules/64-btrfs.rules ...and for LVM2: https://git.fedorahosted.org/cgit/lvm2.git/tree/udev/69-dm-lvm-metad.rules.in |
Interesting, I wasn't aware of that's how things worked now with btrfs. Once a pool is imported creating this fake block devices would be straight forward, this infrastructure largely already exists for zvols. Is there any documentation for how these devices should be named or what ioctl they have to support? |
AFAIK the devices themselves do not need to provide anything. They just need to exist in the sense of the kernel sending out netlink events for them. That is, really a "stub device" which is no more than a "label" for kernel events. The problem with this approach is naming: zfs allows to nest datasets, and if we will try to map dataset names to fake block device names naïvely (i. e. dataset |
It appears this systemd integration has killed the sysv startup? Up until a few weeks ago, I had been using the zfs package provided by zfsonlinux itself: zfs_0.6.5.4-1_amd64.deb, which had some handy /etc/init.d/zfs-{mount,import,share,zed} scripts. These have been removed now that we're installing from debian zfs: zfsutils-linux, which only provides /lib/systemd/system/zfs*, and with a reboot this morning, I discover my pools are no longer being imported and mounted. All other debian packages function fine regardless of whether systemd or sysv are the boot system, via some standard fallbacks. You guys got any idea of what is required to make this work here too? |
@spacelama If you want sysv init support, then you need sysv init scripts. If you want Debian to ship them, then my advice would be to grab the old ZFS sysv init scripts, integrate them into the Debian packaging, and submit a packaging patch to Debian. |
@spacelama: there's no "this systemd integration". There was no work done in relation to this report since I'm not using ZFS anymore, and nobody probably cares much. |
Hi, Looking at dmesg, the zfs* units and kernel modules are loaded about 10 seconds before usb drives spin up, and at that time there is nothing to import. |
There has been some progress on this front and a proposed prototype for comment, review and testing in #4943. We'd love to get some feedback on it. |
First, this is not an issue report per se, but rather an "RFC issue".
Currently, zfs pool importing and mounting completely bypasses the udev and hotplug machinery. That is, even the systemd pool import unit file begins with:
It does not hook up itself to
local-fs.target
, nothing. Moreover, zfs has its own dataset mounting machinery which, again, bypasses the systemd state machine. This may sound beneficial to most due to their familiarity, but (from top of my head — the list is not too impressive, but it isn't exhaustive):udevadm settle
(races with disk controller init).One of the ways to solve this, for ZFS on Linux specifically, would be to integrate nicely into the existing event/dependency infrastructure (the other way would be to devise a separate hotplug handling subsystem which does not use
udevadm settle
, which is likely not going to happen). In particular:Or, other way around:
ENV{SYSTEMD_READY}=0
on all block devices which appear to participate in zfs pools;ENV{SYSTEMD_READY}=1
on all block devices of this pool;Is anybody interested in this? Maybe there are better ways? Maybe this is already done, just not reflected in mans and anywhere?
The text was updated successfully, but these errors were encountered: