You are not logged in.

#1 2012-07-11 21:35:07

boast
Member
Registered: 2010-09-28
Posts: 219

[SOLVED] Can't get systemd to mount nfs on boot

I have "/usr/lib/systemd/system/mnt-shared.mount" with

 [Unit]
 Description=/mnt/shared
 Wants=rpc-statd.service
 After=network.target rpc-statd.service

 [Mount]
 What=10.0.0.3:/home/shared
 Where=/mnt/shared
 Type=nfs

but when I reboot the mount never occurs. I have to manually do "systemctl start mnt-shared.mount" every time.

Is there something special I have to do for systemd to use .mount files automatically?

Last edited by boast (2012-07-13 20:43:21)


Asus M4A785TD-V ;; Phenom II X4 @ 3.9GHz ;; Ripjaws 12GB DDR3-1600 ;; 128GB Samsung 830 ;; MSI GTX460 v2 w/ blob ;; Arch Linux + KDE 4.x

Offline

#2 2012-07-12 00:02:06

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Can't get systemd to mount nfs on boot

What's wrong with using /etc/fstab?

Offline

#3 2012-07-12 19:20:05

boast
Member
Registered: 2010-09-28
Posts: 219

Re: [SOLVED] Can't get systemd to mount nfs on boot

falconindy wrote:

What's wrong with using /etc/fstab?

from the wiki, it says fstab trys to mount before the nfs service is started, so it doesn't work.


Asus M4A785TD-V ;; Phenom II X4 @ 3.9GHz ;; Ripjaws 12GB DDR3-1600 ;; 128GB Samsung 830 ;; MSI GTX460 v2 w/ blob ;; Arch Linux + KDE 4.x

Offline

#4 2012-07-12 22:15:55

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: [SOLVED] Can't get systemd to mount nfs on boot

The wiki is wrong.

Offline

#5 2012-07-13 06:17:08

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [SOLVED] Can't get systemd to mount nfs on boot

i simply use autofs


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#6 2012-07-13 08:33:49

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: [SOLVED] Can't get systemd to mount nfs on boot

In the beginning with systemd I had nfs mounting problems too. But after some extensive testing I found that the fstab mounting was the  best with some systemd adjustments.

192.168.1.250:/ /mnt/SERVER_NYTT nfs4 noauto,rw,hard,async,intr,rsize=81920,wsize=81920,_netdev,clientaddr=192.168.1.251,x-systemd.automount 0 0

All these options might not suit you but noauto and  x-systemd.automount are the important ones. You can test it by doing  systemd-analyze blame. With this setup systemd takes care of all the before, after, requires stuff pretty well by itself.

Last edited by swanson (2012-07-13 08:35:50)

Offline

#7 2012-07-13 08:55:10

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [SOLVED] Can't get systemd to mount nfs on boot

boast wrote:

Is there something special I have to do for systemd to use .mount files automatically?

You'll have to enable the unit file with "systemctl enable ..."


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#8 2012-07-13 09:44:04

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [SOLVED] Can't get systemd to mount nfs on boot

progandy wrote:
boast wrote:

Is there something special I have to do for systemd to use .mount files automatically?

You'll have to enable the unit file with "systemctl enable ..."

This won't work because the mount file doesn't have an [Install] section.

@boast : you should put custom unit files into /etc/systemd/system/ , not /usr/lib/systemd/system/. Nevertheless, as mentioned, you should use /etc/fstab instead in this case. I will update the wiki about this.

Offline

#9 2012-07-13 20:43:11

boast
Member
Registered: 2010-09-28
Posts: 219

Re: [SOLVED] Can't get systemd to mount nfs on boot

great, working now. thanks everyone


Asus M4A785TD-V ;; Phenom II X4 @ 3.9GHz ;; Ripjaws 12GB DDR3-1600 ;; 128GB Samsung 830 ;; MSI GTX460 v2 w/ blob ;; Arch Linux + KDE 4.x

Offline

#10 2012-07-13 21:17:38

swanson
Member
From: Sweden
Registered: 2011-02-05
Posts: 759

Re: [SOLVED] Can't get systemd to mount nfs on boot

Well, how?

Offline

#11 2012-10-13 23:46:59

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: [SOLVED] Can't get systemd to mount nfs on boot

Just so it is clear to other users, the solution to having systemd mount your nfs mounts after the network comes up:

nfserver:/exportname   /path/to/mount   nfs4   defaults,x-systemd.automount   0   0

Offline

Board footer

Powered by FluxBB