# How enable NFS service for Systemd?

## pmam

Hi,

Please let me know how to enable NFS service in Systemd machine - 

I mean instead of '/etc/init.d/nfs start'?

----------

## keet

Per the Gentoo systemd documentation, it would be something along the lines of 'systemctl enable servicename' (to make it run at startup) or 'systemctl start servicename' (to start it right away).  The list of services should be in /usr/lib/systemd/system.  You might also need to start rpc-idmapd.service and rpc-mountd.service.

----------

## pmam

Keet Hi,

 *Quote:*   

>  'systemctl enable servicename' (to make it run at startup) or 'systemctl start servicename' (to start it right away

 

Yes, I know how to enable and to start service in Systemd machine -

but I do not know what are the services that replace /etc/init.d/nfs start in openRC machine.

However, you gave me a good start - you pointed me out to /usr/lib/systemd/system - I missed it in Gentoo Systemd documentation -

it is really a global available services, and important to know it!

As you mentioned:  *Quote:*   

>  You might also need to start rpc-idmapd.service and rpc-mountd.service.

 

OK - And I assume that nfsd.service also needed - But where do I find the exact needed services for NFS?

Thanks

----------

## pmam

Keet Hi,

 *Quote:*   

> You might also need to start rpc-idmapd.service and rpc-mountd.service.

 

I found  rpc-mountd.service but not rpc-idmapd.service -

Maybe rpc-statd.service or rpcbind.service, or both of them?

Thanks

----------

## pmam

Hi,

I found the relevant services for NFS/Systemd: nfsd, rpc-mountd, rpc-statd, rpcbind and followed NFS Wiki, 

and now can see and share home directory of my  machine (server) from my SAT TV receiver (client).

However - I do not know why can not see and share directories between two Linux machines - One is Gnome/Systemd and the other is KDE/openRC??

Maybe something missing regarding the configuration of Server and Client - Should I define one machine as a Server and the other as Client, or both of them can be Server and Client? Actually, each machine sometime is Server and sometime is Client - Right?  

As far as I know, when NFS is working I can see and transfer files between Linux machines by enter the 'Network' in Dolphin - Right? Or there is another way to do it?

----------

## keet

 *Quote:*   

> I do not know why can not see and share directories between two Linux machines.

 

How are you trying to see them?  Can you mount it using something like this?

```
mount -v server:path mountpoint
```

The verbose switch might help show what is going wrong, if something does go wrong.  Once you have it working here, using the basic command, you can know that it's working in general, and then see whether G.U.I. programs work.

----------

## pmam

Dear Keet,

I followed this https://wiki.gentoo.org/wiki/NFSv4 and I really have 'mounting issue' - 

In the Client part of this Wiki there a line to add to etc/fstab: 

```
server:/         /mnt     nfs     rw,_netdev,auto   0  0

```

  - When I add the line with my server name: 

```
  mg_host:/         /mnt     nfs     rw,_netdev,auto   0  0
```

I get a mounting ERROR during booting. If my server name is : mg_host (the other one is: mg_6300) - What is the right way to enter this line?

The same question regarding your suggestion: 

```
mount -v server:path mountpoint
```

 - 

When hit this command I get the following error:

```
mount -v mg_host:/home /home

mount.nfs: Failed to resolve server mg_host: Name or service not known
```

 and when trying mounting to other machine:

```
 mount mg_6300:/home /home

mount.nfs: Failed to resolve server mg_6300: Name or service not known
```

I do not have experience with mounting commands, so please let me know how exactly I need to write this command -

considering my server name and the directories according the Wiki. 

I do know that mounting is important issue in Linux but I still do no figure out it deeply - 

I would appreciate if you give a few words about: Why we need it?

Sorry for the fundamental question but I feel it is important to know...

Thanks

----------

## keet

I would try using the I.P. address first, since it seems to be having trouble resolving the hostname.  If that works, then make sure that /etc/hosts is configured correctly for your hostnames.

This is one of my lines from fstab.  I set it up a while ago, and have not switched to the N.F.S. 4 way of doing it:

```
myserver:/usr/portage/distfiles      /usr/portage/distfiles   nfs      rw,noauto,nolock,nfsvers=3   0 0
```

I actually just switched from systemd back to init/openrc, and I had a bit of trouble setting up N.F.S., myself.  I thought that the three services above (nfsd, rpc-mountd, and rpc-statd) were the right ones (https://wiki.archlinux.org/index.php/NFS also mentions them), but maybe I am missing one.

----------

## pmam

Dear Keet,

Here are the outputs with IP - My IP is: 10.0.0.6:

```
mount -v 10.0.0.6:/home /home

mount.nfs: timeout set for Sun May  4 16:51:32 2014

mount.nfs: trying text-based options 'vers=4,addr=10.0.0.6,clientaddr=10.0.0.6'
```

 and from me machine to other machine:

```
mount -v 10.0.0.7:/home /home

mount.nfs: timeout set for Sun May  4 16:52:17 2014

mount.nfs: trying text-based options 'vers=4,addr=10.0.0.7,clientaddr=10.0.0.6'
```

What these outputs says - Is it ok and there is a problem with host name?

You had problem with Systemd... I have two machines: one with Systemd and the other with openRC - But the same problem - 

As I said earlier, I can see and mount and share from my SAT TV receiver with NFS (with Samba I see the directories but can not mount and share) -

However, do not see and share between machines on the same LAN.

EDIT: You are right I had a mistake with my host name   :Crying or Very sad:   Here is the right mount:

```
mount -v mg_e2180:/home /home

mount.nfs: timeout set for Sun May  4 17:10:11 2014

mount.nfs: trying text-based options 'vers=4,addr=10.0.0.6,clientaddr=10.0.0.6'
```

Thanks

----------

## keet

The output itself looks ok.  I see the same output, and it mounts the directories fine.  If it's not mounting them for you, what is your firewall configuration?  Maybe it's blocking something.

By the way, thanks for your post.  I switched to N.F.S. 4, and it seems to be working for me.

----------

## pmam

Dear Keet,

First, I am glad to hear that you upgraded to NFS4 - Nice to know that I contributed something to the @world   :Smile: 

Regarding Firewall... WOW - I did not even think about it - I really did not configure anything -

Does any Firewall configuration is including in the default Gentoo's installing? If yes - Probably you find something critical.

How can I check the firewall status? 

Thanks

----------

## keet

By default, Gentoo doesn't come with a firewall (I think).  If you haven't set one up, then it's probably not a concern.  For me, I use a rather restrictive iptables setup, so it became a problem for me when I was setting up nfs (among other things).  If you haven't enabled one, then it's probably not a concern.

----------

## pmam

Dear Keet,

With your helping tips (and others...) I succeeded to mount as a client to NFS server - 

But there are some issues as I write down in this topic:

https://forums.gentoo.org/viewtopic-t-989430-highlight-.html

Please take a look and let mo know if you have any tip.

Thanks

----------

