mount Linux sharing folder on another linux machine using nfs
I have five Linux machine, I want to create one folder on one Linux machine and share this folder on remaining Linux machine? how do we do?
Use NFS. I don’t want explain more about NFS. Here I am going to show how do we do?
If you want to share one folder of linux (1) machine,
[root@siebelfs ~]# mkdir /test
Create test file
[root@siebelfs test]# vi test.conf azar
and then Save it.
You need to check it out Whether portmap and nfs running or not
[root@siebelfs ~]# chkconfig --list portmap portmap 0:off 1:off 2:off 3:on 4:on 5:on 6:off [root@siebelfs ~]# chkconfig portmap on [root@siebelfs ~]# chkconfig --list portmap portmap 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@siebelfs ~]# ps ax | grep portmap 3228 ? Ss 0:00 portmap 4491 pts/1 R+ 0:00 grep portmap
For NFS
[root@siebelfs ~]# chkconfig --list nfs nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@siebelfs ~]# chkconfig nfs on [root@siebelfs ~]# chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off And then, restart portmap and nfs service [root@siebelfs ~]# service portmap restart Stopping portmap: [ OK ] Starting portmap: [ OK ] [root@siebelfs ~]# 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 ] [root@siebelfs ~]# ps ax | grep nfs 4664 ? S< 0:00 [nfsd4] 4666 ? S 0:00 [nfsd] 4667 ? S 0:00 [nfsd] 4668 ? S 0:00 [nfsd] 4669 ? S 0:00 [nfsd] 4670 ? S 0:00 [nfsd] 4671 ? S 0:00 [nfsd] 4672 ? S 0:00 [nfsd] 4673 ? S 0:00 [nfsd] 4691 pts/1 R+ 0:00 grep nfs [root@siebelfs ~]# chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@siebelfs ~]# ps ax | grep mountd 4676 ? Ss 0:00 rpc.mountd 4694 pts/1 R+ 0:00 grep mountd [root@siebelfs ~]# chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@siebelfs ~]# ps ax | grep portmap 4585 ? Ss 0:00 portmap 4699 pts/1 R+ 0:00 grep portmap
Now We need to add shared folder directory in /etc/exports file like below , Here I have used four linux machine, If I missed any ipaddress of client linux machine
you can not able to access this folder.
[root@siebelfs ~]# vi /etc/exports /test ipaddress(rw) /test ipaddress(rw) /test ipaddress(rw) /test ipaddress(rw) and then save it. Again restart nfs service only. [root@siebelfs ~]# service nfs restart Shutting down NFS mountd: [ OK ] Shutting down NFS daemon: [ OK ] Shutting down NFS quotas: [ OK ] Shutting down NFS services: [ OK ] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ]
Now Go to another linux machine (client).
configure portmap and nfs like above. but don’t add any line in /etc/exports file.(in case if you want to
share this machine folder for other client machine , you can add line like above).
here 10.1.x.xx — ipaddress of shared folder machine.
[root@siebelas ~]# mkdir /test [root@siebelas ~]# mount -t nfs -o rw 10.1.X.XX:/test /test [root@siebelas ~]# cd /test [root@siebelas test]# ls test.conf
Its give me error when mount me according process step by step.
/etc/init.d/nfs start ,/etc.init.d/nfs restart why they are use as you give chconfig portmap on ,chkconfig nfs on;