Mounting Local NFS Share In Linux

On occasion you may want to mount a local nfs share for testing. To do so you will need to perform the following:

This is the directory you will end up exporting

[root@computer ~]# mkdir /data1/nfs

Edit this file to add the directory above for exporting

[root@computer ~]# vi /etc/exports
[root@computer ~]# cat /etc/exports
/data1/nfs      localhost(rw,no_root_squash)

Now enable the nfs service

[root@computer ~]# chkconfig nfs on

If you see this error

error reading information on service nfsd: No such file or directory

You typed “nfsd” instead of “nfs” on the chkconfig

Now restart the nfs service

[root@computer ~]# service nfs restart
Shutting down NFS mountd:                                  [FAILED]
Shutting down NFS daemon:                                  [FAILED]
Shutting down NFS quotas:                                  [FAILED]
Shutting down NFS services:                                [FAILED]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]

Finally, perform the mount command

[root@computer ~]# mkdir /mnt/nfsshare
[root@computer ~]# mount -t nfs localhost:/data1/nfs /mnt/nfsshare

Be the first to comment

Leave a Reply