Difference between revisions of "NFS mount on EA board"

From Klaus' wiki
Jump to: navigation, search
(Centos 7)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Exporting a directory from the development host and mounting this directory eases the development process.
 
Exporting a directory from the development host and mounting this directory eases the development process.
  
In /etc/exports add this line
+
==Configuration on devhost==
 +
 
 +
In /etc/exports add this line per exported directory
  
 
<source lang="bash">
 
<source lang="bash">
Line 12: Line 14:
  
 
<source lang="bash">
 
<source lang="bash">
/home/emb/uClinuxDist   10.1.18.73(rw,sync)
+
/home/emb/uClinux-dist   10.1.18.73(rw,sync)
 
</source>  
 
</source>  
  
And every time you have changed in /etc/exports then you have to reload nfs service.
+
Change to suit your requirements.
  
 +
You'll have to enable a few ports extra in the NFS configuration file: /etc/sysconfig/nfs
  
 +
Remove the remarks (#) on the lines with these port numbers:
  
 
<source lang="bash">
 
<source lang="bash">
/sbin/service nfs reload
+
LOCKD_TCPPORT=32803
 +
LOCKD_UDPPORT=32769
 +
MOUNTD_PORT=892
 +
STATD_PORT=662
 +
</source>
  
 +
And every time you have changed in /etc/exports or other configuration files you have to reload nfs service.
 +
 +
<source lang="bash">
 +
/sbin/service nfs reload
 
</source>
 
</source>
  
Line 30: Line 42:
 
</source>
 
</source>
  
Select '''Customize''' and set a star in the NFS4 field.
+
Select '''Customize''' and set a star in the NFS4 field and add in the field for other ports the following ports:
  
 
<source lang="bash">
 
<source lang="bash">
mount -t nfs <source host>:<source export directory> <destination directory>
+
111:tcp 111:udp 32803:tcp 32803:udp 32769:tcp 32769:udp 892:tcp 892:udp 662:tcp 662:udp
 
</source>
 
</source>
  
where the '''<source host>''' can be an IP address, the '''<source directory>''' is the directory that was exported from the development host and '''<destination directory>''' is the directory on where the exported directory shall be mounted.
+
Ensure that nfs is running
 +
 
 +
<source lang="bash">
 +
$ service nfs stat
 +
rpc.mountd is stopped
 +
nfsd is stopped
 +
rpc.rquotad is stopped
 +
</source>
 +
 
 +
it is not - to start it issue
 +
 
 +
<source lang="bash">
 +
$ chkconfig --list|grep nfs
 +
nfs            0:off  1:off  2:off  3:off  4:off  5:off  6:off
 +
nfslock        0:off  1:off  2:off  3:on    4:on    5:on    6:off
 +
 
 +
$ chkconfig --level 345 nfs on
 +
$ service nfs start                                                                                   
 +
Starting NFS services:                                    [  OK  ]                                                                     
 +
Starting NFS quotas:                                      [  OK  ]                                                                     
 +
Starting NFS daemon:                                      [  OK  ]                                                                     
 +
Starting NFS mountd:                                      [  OK  ]                                                                     
 +
Stopping RPC idmapd:                                      [  OK  ]                                                                     
 +
Starting RPC idmapd:                                      [  OK  ]
 +
</source>
 +
 
 +
==Test from bren==
 +
 
 +
Provided you have included bren (10.1.18.73) in your exports on the devhost you can check if your set-up is working correct  by issuing this command on your bren login:
 +
 
 +
<source lang="bash">
 +
[klausk@bren ~]$  /usr/sbin/showmount -e 10.1.18.212
 +
Export list for 10.1.18.212:
 +
/home/nfsexport 10.1.18.73,10.2.2.82
 +
</source>
 +
 
 +
==Mount on the EA board==
 +
 
 +
On the EA board issue this command:
 +
<source lang="bash">
 +
mount -t nfs -o nolock,rsize=4096,wsize=4096 < source host>:< source export directory> <destination directory>
 +
</source>
 +
 
 +
where the '''"< source host>"''' can be an IP address, the '''"< source directory>"''' is the directory that was exported from the development host and '''"<destination directory>"''' is the directory on where the exported directory shall be mounted.
 +
 
 +
<source lang="bash">
 +
Example: mount -t nfs -o nolock,rsize=4096,wsize=4096 192.168.0.100:/home/klaus/exportdir /mnt
 +
</source>
 +
 
 +
==Centos 7==
 +
 
 +
Edit the export files as shown above.
 +
 
 +
Edit the /etc/sysconfig/nfs ensuring the correct ports are used.
 +
 
 +
<source lang=text>
 +
# TCP port rpc.lockd should listen on.
 +
LOCKD_TCPPORT=32803
 +
# UDP port rpc.lockd should listen on.
 +
LOCKD_UDPPORT=32769
 +
MOUNTD_PORT=892
 +
STATD_PORT=662
 +
STATD_OUTGOING_PORT=2020
 +
</source>
 +
 
 +
Open the the above ports in the firewall-config program.
 +
 
 +
Finally enable and start the nfs service
 +
<source lang=bash>
 +
]$ systemctl enable nfs-server.service
 +
]$ systemctl start nfs-server.service
 +
]$ systemctl status nfs
 +
</source>
 +
 
 +
On the remote add a line to /etc/fstab as described above and mount it
 +
<source lang=bash>
 +
]$ mount -av
 +
</source>
 +
the -a instructs mount to (re)mount everything and the -v gives a verbose output.

Latest revision as of 14:58, 14 September 2014

Exporting a directory from the development host and mounting this directory eases the development process.

Configuration on devhost

In /etc/exports add this line per exported directory

directory hostname(options)

where directory is the directory you want to export to the net and the hostname is for instance an IP address of your EA board. The options can be rw,sync.

Example:

/home/emb/uClinux-dist   10.1.18.73(rw,sync)

Change to suit your requirements.

You'll have to enable a few ports extra in the NFS configuration file: /etc/sysconfig/nfs

Remove the remarks (#) on the lines with these port numbers:

LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662

And every time you have changed in /etc/exports or other configuration files you have to reload nfs service.

/sbin/service nfs reload

Configure the firewall to allow NFS traffic to come through

system-config-securitylevel-tui

Select Customize and set a star in the NFS4 field and add in the field for other ports the following ports:

111:tcp 111:udp 32803:tcp 32803:udp 32769:tcp 32769:udp 892:tcp 892:udp 662:tcp 662:udp

Ensure that nfs is running

$ service nfs stat
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped

it is not - to start it issue

$ chkconfig --list|grep nfs
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off
 
$ chkconfig --level 345 nfs on
$ service nfs start                                                                                     
Starting NFS services:                                     [  OK  ]                                                                       
Starting NFS quotas:                                       [  OK  ]                                                                       
Starting NFS daemon:                                       [  OK  ]                                                                       
Starting NFS mountd:                                       [  OK  ]                                                                       
Stopping RPC idmapd:                                       [  OK  ]                                                                       
Starting RPC idmapd:                                       [  OK  ]

Test from bren

Provided you have included bren (10.1.18.73) in your exports on the devhost you can check if your set-up is working correct by issuing this command on your bren login:

[klausk@bren ~]$  /usr/sbin/showmount -e 10.1.18.212
Export list for 10.1.18.212:
/home/nfsexport 10.1.18.73,10.2.2.82

Mount on the EA board

On the EA board issue this command:

mount -t nfs -o nolock,rsize=4096,wsize=4096 < source host>:< source export directory> <destination directory>

where the "< source host>" can be an IP address, the "< source directory>" is the directory that was exported from the development host and "<destination directory>" is the directory on where the exported directory shall be mounted.

Example: mount -t nfs -o nolock,rsize=4096,wsize=4096 192.168.0.100:/home/klaus/exportdir /mnt

Centos 7

Edit the export files as shown above.

Edit the /etc/sysconfig/nfs ensuring the correct ports are used.

# TCP port rpc.lockd should listen on.
LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
STATD_OUTGOING_PORT=2020

Open the the above ports in the firewall-config program.

Finally enable and start the nfs service

]$ systemctl enable nfs-server.service
]$ systemctl start nfs-server.service
]$ systemctl status nfs

On the remote add a line to /etc/fstab as described above and mount it

]$ mount -av

the -a instructs mount to (re)mount everything and the -v gives a verbose output.