On Sun, May 14, 2017 at 12:21:47PM +0200, Guus Sliepen wrote: > Users with filesystems mounted over NBD are surprised that these mount > points are not unmounted before the network is shutdown.
As with any network mount that isn't an explicit network file system (like NFS), you should add a _netdev option to the nbd fstab entry. Did you do that? > This can cause data loss. The documentation should be updated to tell > users how to make mounts properly depend on the network (for example > using filesystem options in fstab). I'm not sure where that documentation would have to go; suggestions are welcome. > I see there is currently a nbd@.service that replaces the SysV init > script. However, it does not declare a dependency on > network-online.target. That could be added, but I don't think it will fix this issue; I could be wrong though > There is a Before=dev-%i.device. I assume that should provide the > necessary dependencies? However, I don't see a generator being created > for such .device files, and no documentation in the package anywhere > how to make those. .device units are internal virtual units only; they are created as soon as a /dev node is marked as ready to be used by udev (hence the fact that udev and systemd are in the same source tree these days). There is no actual .device unit file in your systemd configuration directory. The Before= is placed so that, *at shutdown time*, the nbd@nbdX unit is ordered correctly relative to the .device unit, and whatever depends on that .device unit (e.g., .mount units for mount points). You still need to add the _netdev option, however. -- < ron> I mean, the main *practical* problem with C++, is there's like a dozen people in the world who think they really understand all of its rules, and pretty much all of them are just lying to themselves too. -- #debian-devel, OFTC, 2016-02-12