[arch-general] Mounting /var early in systemd
teg at jklm.no
Tue Dec 11 18:40:43 EST 2012
On Tue, Dec 11, 2012 at 4:36 PM, Paul Gideon Dann <pdgiddie at gmail.com> wrote:
> I'm migrating a diskless cluster from initscripts to systemd. The problem I
> have is that the nodes each need to mount their own separate /var (identified
> by hostname) from the NFS server when they boot.
I have never done something like this with systemd, but it should
definitely be possible.
> With initscripts, I used a sysinit_end hook to do the job, which worked pretty
> well. However, with systemd I've really hit a brick wall. I can't get the
> unit to start early enough, because systemd creates so many sockets (in /var)
> so early, and there's no target that is ordered before the socket units are
> started. This means that the early sockets get masked when the "real" /var is
> mounted, and things break.
> I think the only solution with systemd is to explicitly specify each socket in
> "Before=" for my unit, which is likely to break if anything changes in future.
> It might also be possible to create a generator that automates this, but
> that's still pretty ugly.
Sockets in /var should automatically be ordered After=var.mount, so
this should in theory just work. How are you mounting /var? I assume
an fstab entry would not do in your setting, so I guess you somehow
generate a custom var.mount file? Please link to the code so I could
have a look.
> Right now, I'm thinking the only sensible solution is to forget doing it with
> systemd and push the mounting of /var up into initcpio, but that's admitting
That should definitely not be necessary.
More information about the arch-general