Jump to Navigation

092 - NFS mount

1. Configuration of NFS Server.

* Edit /etc/exports

NFS client : 192.168.1.34, 35

/home/share 192.168.1.34(rw, no_root_squash) 192.168.1.35(ro)

rw means read/write. no_root_squash is a setting that allows nfs clients to connect as root.
Without this setting, the root user on clients that connect has the permissions of the user 'nfsnobody', uid 65534.

* Edit /etc/hosts.allow, if you need.

prtmap: 192.168.1.34 192.168.1.35

* Start pormap

# /etc/init.d/portmap start
# /usr/sbin/rpcinfo -u localhost portmap
(ps aux | grep portmap)

* To start portmap automatically.

/sbin/chkconfig --add portmap
/sbin/chkconfig --level 35 portmap on
/sbin/chkconfig --list portmap

* To start NFS server.

# service nfslock restart (If you need.)

# service nfs restart

Stopping NFS mountd:                                       [  OK  ]
Stopping NFS daemon:                                       [  OK  ]
Stopping NFS services:                                     [  OK  ]
Stopping NFS quotas:                                       [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]

# chkconfig nfs on

* Check the processes if they are running well.

# rpcinfo -p

   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp    738  status
    100024    1   tcp    741  status
    100011    1   udp    698  rquotad
    100011    2   udp    698  rquotad
    100011    1   tcp    701  rquotad
    100011    2   tcp    701  rquotad
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100021    1   udp  31256  nlockmgr
    100021    3   udp  31256  nlockmgr
    100021    4   udp  31256  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100021    1   tcp  26665  nlockmgr
    100021    3   tcp  26665  nlockmgr
    100021    4   tcp  26665  nlockmgr
    100005    1   udp    729  mountd
    100005    1   tcp    732  mountd
    100005    2   udp    729  mountd
    100005    2   tcp    732  mountd
    100005    3   udp    729  mountd
    100005    3   tcp    732  mountd

 

2. Configuration of NFS Client.

* Start portmap.

/etc/init.d/portmap start
/usr/sbin/rpcinfo -u localhost portmap
(ps aux | grep portmap)

* Create a mount directory.

# midir /mnt/share

* Mount the share folder.

# mount -t nfs 192.168.1.33:/home/share /mnt/share

* To verify the configuration.

# showmount -e

Export list for oraem1.ntcltdna.ad:
/d02/my_bkup1  192.168.17.22
/d02/data_inst 192.168.17.131
/d02/my_bkup2 192.168.17.23

* Create an entry in /etc/fstab for automatic.

192.168.1.33:/home/share     /mnt/share      nfs    defaults        0 0

* umount

# umount /mnt/share

 

3. If you change /etc/exports after all

# exportfs -a

The exportfs command is used to maintain the current table of exported file systems for NFS.

-a
    Export or unexport all directories.
-o options,...
    Specify a list of export options in the same manner as in exports(5).
-i
    Ignore the /etc/exports file, so that only default options and options given on the command line are used.
-r
    Reexport all directories. It synchronizes /var/lib/nfs/xtab with /etc/exports. It removes entries
    in /var/lib/nfs/xtab which are deleted from /etc/exports, and remove any entries from the kernel export table
    which are no longer valid.
-u
    Unexport one or more directories.
-v
    Be verbose. When exporting or unexporting, show what's going on.
    When displaying the current export list, also display the list of export options.

* export a specific directory.

# exportfs 192.168.1.10:/home/user1/pub-data/

* Cancel a specific directory.

# exportfs -u 192.168.1.10:/home/user1/pub-data/

* Check the directory exported.

# exportfs   or   exportfs -i

 

4. Verify all exported directories in localhost

# showmount -e localhost

 

 



Main menu 2

Story | by Dr. Radut