Network File Syatem Installation
Network File System (NFS) is a distributed file system protocol. its allowing a user on a client computer to access files over a computer network much like local storage is accessed. NFS builds on the Open Network Computing Remote Procedure Call (ONC RPC) system. is an application layer protocol. NFS is an open IETF standard defined in RFC.
Installation
sudo apt-get update
sudo apt-get install nfs-kernel-server rpcbind
Create a '/export/' directory that we will use to host the filesystem
sudo mkdir /export/
Set the permissions of the hosted filesystem buy adding the following line to file `/etc/exports':
/export/ *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)
To avoid potential file permission problems we will avoid using NFSv4. Set the default to NFSv3 by editing `/etc/default/nfs-kernel-server' as shown:
# Number of servers to start up
# To disable nfsv4 on the server, specify `--no-nfs-version 4' here
#RPCNFSDCOUNT=8
RPCNFSDCOUNT="--no-nfs-version 4"
Then restart the `nfs-kernel-server' service:
service nfs-kernel-server restart
Now check that portmapper',
nfs', and mountd' are all running on both
tcp' and `udp':
# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 43672 status
100024 1 tcp 56293 status
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049
100227 3 tcp 2049
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049
100227 3 udp 2049
100021 1 udp 53079 nlockmgr
100021 3 udp 53079 nlockmgr
100021 4 udp 53079 nlockmgr
100021 1 tcp 50750 nlockmgr
100021 3 tcp 50750 nlockmgr
100021 4 tcp 50750 nlockmgr
100005 1 udp 50127 mountd
100005 1 tcp 48215 mountd
100005 2 udp 49557 mountd
100005 2 tcp 46457 mountd
100005 3 udp 36349 mountd
100005 3 tcp 54121 mountd
Testing our NFS server
Extract your desired root filesystem into the /export/' directory, optionally placing it in a subdirectory. In this example we extracted the root filesystem to
/export/test_fs/'.
Mount on Ubuntu
Test nfs mount with ubuntu PC by
sudo mount -t nfs -vvvv -o v3 192.168.0.108:/export/test_fs /mnt/test
where :
/mnt/test is the location in ubuntu where nfs will mount
192.168.0.108 ip of nfs server
/export/test_fs is nfs server directory when need to be mounted
-o v3 means use nfs version 3
-vvvv use verbose mode
Mount nfs for linux bootargs:
Save your host PC's IP address to the 'serverip' environment variable
Uboot# set serverip <host_pc_ip_address>
Uboot# saveenv
Next modify U-Boot's boot args to find the root filesystem using NFS:
Uboot# set origbootargs "$bootargs"
Uboot# set bootargs "console=ttyAMA0,115200n8 root=/dev/nfs ip=dhcp nfsroot=${serverip}:/export/juno/fs rw rootwait earlyprintk=pl011,0x7ff80000 debug"
Uboot# saveenv
©2023-2024 rculock.com