[systemd-devel] help: unmounting iscsi xfs filesystem without using netdev in /etc/fstab
Michael Chapman
mike at very.puzzling.org
Tue Aug 27 09:33:33 UTC 2019
On Tue, 27 Aug 2019, Tony Rodriguez wrote:
> Managed to detect/mount iscsi devices without using _netdev keyword in
> /etc/fstab. Made changes within src/fstab-generator/ftstab-generator.c and it
> seems to work. The only problem is during shutdown/reboot, my iscsi xfs
> filesystem does not unmount cleanly before the network/iscs service/system is
> shutdown. When this happens I receive a xfs error/warning.
>
> However this doesn't happen when _netdev is specified in /etc/fstab for my
> iscsi device. Seems _netdev handles management of mounts/unmounts before
> killing things off. How exactly does _netdev manage unmounting filesystems
> during a shutdown/reboot?
One of the "default dependencies" for a mount unit that systemd thinks is
a network filesystem is After=network.target. During shutdown, this
ensures the filesystem is unmounted before networking is brought down:
https://github.com/systemd/systemd/blob/fef40ceb5dfbb76d4733e579846a380a224efd55/src/core/mount.c#L455-L482
If you're not using the _netdev keyword, and systemd does not otherwise
think this is a remote filesystem, you will need to add this dependency
manually. You'll probably also want:
Wants=network-online.target
After=network-online.target
to match the code linked above.
> I would like to invoke that same netdev unmount
> code/logic myself from within systemd source but without using the _netdev
> keyword. Unfortunately it is a requirement to not use _netdev within
> /etc/fstab for iscsi. Seems _netdev takes a long time to timeout and continue
> when unable to mount.
I haven't been following your earlier threads too closely, but if you're
stuck with stupid fstab requirements why not just bypass them with
altogether with drop-in:
# path-to-mountpoint.mount.d/20-Options.conf
[Mount]
Options=_netdev
Plus any other options you may need, of course; this directive is not
"list-valued", so you can't use it to add just one option.
> Checked src/core/mount.c and src/core/unmount.c but not sure what to do to
> duplicate how _netdev manages unmounting before the system is shutdown or
> rebooted. Do I need a special before and after keyword in /etc/fstab so my
> xfs filesystems is unmounted before shutting down the iscsi
> service/network/system? If so, will such keywords also propagate to
> /run/systemd/generator/remote-fs-target.requires?
>
>
> Thanks,
> Tony
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
More information about the systemd-devel
mailing list