On Mon, 07.11.16 12:56, Steve Dickson (ste...@redhat.com) wrote: > > > On 11/04/2016 04:47 PM, Lennart Poettering wrote: > > On Fri, 04.11.16 11:12, c...@endlessnow.com (c...@endlessnow.com) wrote: > > > >>> On Thu, Nov 03, 2016 at 04:01:15PM -0700, c...@endlessnow.com wrote: > >> >> so.... I'm using CentOS 7, and we're mounting a disk from our > >> iSCSI > >> >> SAN and then we want to export that via NFS. But on a fresh boot > >> the > >> >> nfs-server service fails because the filesytem isn't there yet. > >> Any > >> >> ideas on how to fix this? > >>> Add RequiresMountsFor=/your/export/path to nfs-server.service > >> (first, apologize for the formatting using a very limted web based > >> i/f) > >> > >> I tried creating a nfs-server.service.d directory with a > >> required-mounts.conf with that line in it and it did not work. > >> However adding the line directly to the nfs-server.service file did > >> work. Can't we add this using a nfs-server.service.d directory and > >> conf file? > > mkdir -p /etc/systemd/system/nfs-server.service.d/ > > echo "[Unit]" > /etc/systemd/system/nfs-server.service.d/50-myorder.conf > > echo "RequiresMountsFor=/foo/bar/baz" >> > > /etc/systemd/system/nfs-server.service.d/50-myorder.conf > > systemctl daemon-reload > This happens automatically with later nfs-utils. A systemd generator is > created that read /etc/exports and creates RequiresMountsFor= > for anything exported and then read /etc/fstab looking for > nfs or nfs4 types. It creates a Before= entry in the same file. > > The name is order-with-mounts.conf under nfs-server.service.d
I'd always recommend creating such drop-ins with a numeric prefix, to make it easy for other tools to generate drop-ins that are properly ordered against yours. Note that systemd will lexicographically sort all drop-ins by their filenames before reading them, hence it is a good idea to name your dropings "10-foo.conf", "50-bar.conf" or "90-waldo.conf" or something like that. (Using two numerics followed by a dash is only convention, it's not enforced). Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel