[arch-general] Mounting /var early in systemd

Dave Reisner d at falconindy.com
Wed Dec 12 08:05:26 EST 2012

On Wed, Dec 12, 2012 at 11:10:24AM +0000, Paul Gideon Dann wrote:
> On Wednesday 12 Dec 2012 00:40:43 Tom Gundersen wrote:
> > 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.
> That's what I hoped too.  I've tried several approaches.  I'm trying a mount 
> unit here, because I was hoping there might be a bit more magic to it.  
> However, it does mean that I had to hardcode the mount path (%H doesn't seem 
> to work), but if I can get this working, I have a oneshot unit that should 
> take care of that.

I'd sooner use a generator than a oneshot unit to perform a mount.

> I created a "sockets-pre.target" unit, ordered before "sockets.target", and 
> the following unit is ordered before that, because I was hoping that might 
> help.  It doesn't, presumably because the socket units and this unit are all 
> "before" sockets.target, and all get started at the same time.  If the sockets 
> were set "after" sockets-pre.target, this would probably work.  (But in that 
> case they might as well be specified directly in the unit, and the sockets-pre 
> target can be dropped.)

If sockets.target is too late, then order it before that. man bootup
shows a synchronization point at sysinit.target before jobs for
sockets.target are even dispatched.

> [Unit]
> Description=/var directory for the node
> DefaultDependencies=false
> Requires=sockets-pre.target
> Before=sockets-pre.target
> [Mount]
> What=
> Where=/var
> Type=nfs
> Options=v3,nolock
> [Install]
> RequiredBy=local-fs.target
> Bootchart is available here:
> http://giddie.homeip.net/screenshots/cluster-node-var-mount-boot-chart.png
> Thanks,
> Paul

More information about the arch-general mailing list