0

I have three machines -

machineA    10.108.24.132
machineB    10.108.24.133
machineC    10.108.24.134

and all those machines have Ubuntu 12.04 installed in it and I have root access to all those three machines.

Now I am supposed to do below things in my above machines -

Create mount point /opt/exhibitor/conf
Mount the directory in all servers.
 sudo mount <NFS-SERVER>:/opt/exhibitor/conf /opt/exhibitor/conf/

I have already created /opt/exhibitor/conf directory in all those three machines as mentioned above.

Now I am trying to create a Mount Point on all those three machines. So I followed the below process -

Install NFS support files and NFS kernel server

$ sudo apt-get install nfs-common nfs-kernel-server

Create the shared directory

$ mkdir /opt/exhibitor/conf/

Edited the /etc/exports and added the entry like this:

# /etc/exports: the access control list for filesystems which may be exported
#               to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/opt/exhibitor/conf/     10.108.24.*(rw)

Run exportfs

root@machineA:/# exportfs -rv
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "10.108.24.*:/opt/exhibitor/conf/".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exporting 10.108.24.*:/opt/exhibitor/conf

Now I did showmount on machineA

root@machineA:/# showmount -e 10.108.24.132
Export list for 10.108.24.132:
/opt/exhibitor/conf 10.108.24.*

And now when I did this, I am getting an error -

root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/
mount.nfs: access denied by server while mounting 10.108.24.132:/opt/exhibitor/conf

Any idea what wrong I am doing here?

Wesley
  • 32,690
  • 9
  • 82
  • 117
AKIWEB
  • 103
  • 1
  • 1
  • 5
  • Check the logs on the NFS server for clues. – Michael Hampton Dec 17 '13 at 23:59
  • @MichaelHampton: Thanks for suggestion. Can you tell me where I can find the logs for NFS? And also did my exports file looks good? – AKIWEB Dec 18 '13 at 04:13
  • And also, do we need to start something related with NFS? I just installed the NFS server like this `sudo apt-get install nfs-common nfs-kernel-server` and after that I didn't do anything.. – AKIWEB Dec 18 '13 at 04:26

3 Answers3

6

change your /etc/exports from

/opt/exhibitor/conf/     10.108.24.*(rw)

to

/opt/exhibitor/conf/     10.108.24.0/24(rw)
Danielle
  • 76
  • 1
  • Can you explain me what does second line mean here? And should I use this line `/opt/exhibitor/conf/ 10.108.24.0/24(rw)` in all the three machines `/etc/exports`? – AKIWEB Dec 18 '13 at 06:26
  • It means you advertise your nfs share to 10.108.24.0/24 network and allowing client from the same network to access the folder. You only use this line on your nfs server. So, if all the three machine are the nfs server, then you have to put in all the machine. – Danielle Dec 18 '13 at 06:39
  • Ok.. Now when I did this after making the change in export file `root@machineB:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/` from machineB, it worked fine and I didn't got any error. But now how to check whether the mount got created properly or not? – AKIWEB Dec 18 '13 at 06:46
  • type 'mount' in terminal machineB, or you can create a file some file in machineA, if it is properly created you should be able to see the same in machineB – Danielle Dec 18 '13 at 06:48
  • Yup. It works fine. I created a file in machineA and I can see those files in machineB and machineC as well. Thanks for the help.. One last thing, as you can see in my question, I am not using fstab file here so whenever my machine gets restarted up, all the mount will be gone.. So I am not sure, in my case what I am supposed to add in fstab file. Any idea how that will work out? – AKIWEB Dec 18 '13 at 07:01
  • you can put this line in your fstab "10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf nfs auto 0 0" – Danielle Dec 18 '13 at 07:08
  • Ok.. I added the same exact line as you have mentioned. Now I am having very strange issue. I deleted that file from machineA and after deleting that file, I went back to machineB and machineC and I did ls, the whole system got hanged and even ctrl+c was not taking me out. So I close those machineB and machineC and opened again. And after that, I tried doing `cd /opt/exhibitor/conf` but it is getting hanged at `cd /opt/exhibitor/c`. Any idea what is causing the problem? – AKIWEB Dec 18 '13 at 07:24
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/12048/discussion-between-trekkietechie-t-t-and-danielle) – AKIWEB Dec 18 '13 at 07:40
0

Seems like you are trying to do an NFS mount on the same server

root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/

MachineA is 10.108.24.132

Did you try?

root@machineB:/# mkdir -p /opt/exhibitor/conf
root@machineB:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/

and on machineC

root@machineC:/# mkdir -p /opt/exhibitor/conf
root@machineC:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/

You should be able to do if from machineA but using a different directory as the mount point:

root@machineA:/# mkdir -p /opt/exhibitor/conf2
root@machineA:/# sudo mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf2/
Rico
  • 2,235
  • 19
  • 19
  • Thanks for suggestion. I have also tried from machineB as well and I got same error. Is there any way I can see the logs? If yes, then what's the path? – AKIWEB Dec 18 '13 at 04:13
  • And also did my exports file looks good? I have the same content in all the three machines. – AKIWEB Dec 18 '13 at 04:14
  • And also, do we need to start something related with NFS? I just installed the NFS server like this `sudo apt-get install nfs-common nfs-kernel-server` and after that I didn't do anything.. – AKIWEB Dec 18 '13 at 04:29
  • /var/log/syslog on Ubuntu or /var/log/messages on Centos. Or simply look under /var/log – Rico Dec 18 '13 at 16:11
0

beforely, i am sorry my english very bad. but i'll try to write it as good as i can.

i think you need to set a username and password while mounting.

mount -t nfs 10.108.24.132:/opt/exhibitor/conf /opt/exhibitor/conf/ -o username=USERNAME,password=PASSWORD 

i never try nfs, i am using samba in my machine. in samba, we need to add a linux user to the samba user.

smbpasswd -a username

maybe it is same case in nfs.

arcahya
  • 26
  • samba is totally different to NFS. NFS doesn't require username / password as it works off the linux uid/gid – Lawrence Dec 18 '13 at 07:02