NFS built under Linux

Source: Internet
Author: User

I. Introduction to NFS

NFS is the abbreviation for the network file system, which is the web filesystem. A type of distributed file contract, developed by Sun Company. The function is to allow different machines, different operating systems to share personal data through the network, so that the application can access the data on the server disk through the network.

NFS relies on the RPC protocol during file transfer or information transfer. RPC, remote procedure invocation (Procedure call), is a mechanism that enables clients to perform programs in other systems. NFS itself does not provide the protocol and functionality for transmitting information, but NFS allows us to share information over the network, because NFS uses the transport protocol provided by RPC, which can be said to be a program used by the PRC.

Environment Description:
System: CentOS release 6.7 (Final)
NFS ip:10.219.24.22
Web ip:10.219.24.25
Iptables: Firewall is not running

Operation Flow:
1, Software Installation, NFS only need to install two software, under normal circumstances, as the system default software installed
[Email protected] ~]# Rpm-qa|grep rpcbind*
Rpcbind-0.2.0-11.el6.x86_64
[Email protected] ~]# Rpm-qa|grep nfs-utils
Nfs-utils-1.2.3-64.el6.x86_64
Nfs-utils-lib-1.1.5-11.el6.x86_64

Description
[[email protected] ~]# Yum install rpcbind nfs-utils (yum installation if not installed)
Rpcbind Package: The RPC Main program under CentOS
Nfs-utils Package: NFS Service main program, including basic commands and monitoring Programs for NFS

2. Open RCP service
[[email protected] ~]#/etc/init.d/rpcbind start
View Rpcbind Service ports
[Email protected] ~]# Netstat-antlp|grep Rpcbind
TCP 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1462/rpcbind
TCP 0 0::: 111:::* LISTEN 1462/rpcbind
[Email protected] ~]# rpcinfo-p localhost
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 41757 status
100024 1 TCP 42661 Status

3. Turn on NFS Service
[[email protected] ~]#/etc/init.d/nfs start
Starting NFS services: [OK]
Starting NFS quotas: [OK]
Starting NFS mountd: [OK]
Starting NFS daemon: [OK]
Starting RPC IDMAPD: [OK]
[Email protected] ~]# rpcinfo-p localhost
Program vers Proto Port service
......
100005 3 TCP 59454 Mountd
100003 2 TCP 2049 NFS
100003 3 TCP 2049 NFS
100003 4 TCP 2049 NFS
100227 2 TCP 2049 Nfs_acl
100227 3 TCP 2049 Nfs_acl
100003 2 UDP 2049 NFS
100003 3 UDP 2049 NFS
100003 4 UDP 2049 NFS
100227 2 UDP 2049 Nfs_acl
100227 3 UDP 2049 Nfs_acl
....
100021 4 TCP 42905 Nlockmgr

Description: A lot of new registered NFS ports should be visible on RPC

Two services boot from boot
[Email protected] ~]# chkconfig rpcbind on
[[email protected] ~]# chkconfig NFS on

4, Server configuration shared directory (/oradata)

4.1 Confirm Rpcbind, NFS service process is OK before configuration

[[email protected] ~]#/etc/init.d/nfs status
[[email protected] ~]#/etc/init.d/rpcbind status
[ [email protected] ~]# ps-ef|egrep "Rpc|nfs"

4.2 Create a shared directory and authorize ("Nfsnobody")
#nfsnobody the user is automatically created by the system after the RPC, NFS process is enabled
[[email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda3 35G 8.9G 25G 27%/
Tmpfs 491M 76K 491M 1%/dev/shm
/dev/sda1 2.9G 4.5M 2.7G 1%/tmp
/dev/sr0 3.7G 3.7G 0 100%/media/centos_6.7_final
[[email protected] ~]# Mkdir/oradata
[[email protected] ~]# chown-r nfsnobody.nfsnobody/oradata
[[email protected] ~]# chmod 777/oradata
4.3 Modifying the server-side configuration file (/etc/exports)
[[email protected] ~]# cat/etc/exports
#share/data by Andy for XXXX at 20170 812
/oradata 10.219.24.0/8 (rw,sync)
[[email protected] ~]#
4.3 view system-loaded configuration
[[email protected] ~]# cat/var/lib/nfs/etab
/oradata10.219.24.0/8 (Rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_ Squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)
4.4 Re-smooth load service
[[email protected] ~]# showmount-e localhost

5. Client Configuration
[Email protected] ~]#/etc/init.d/rpcbind status
Rpcbind (PID 1469) is running ...
[[email protected] ~]#/etc/init.d/rpcbind start

Mount NFS Shared Directory
[Email protected] ~]# mount-t NFS 10.219.24.22:/oradata/mnt
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda3 35G 8.7G 25G 26%/
Tmpfs 491M 76K 491M 1%/DEV/SHM
/DEV/SDA1 2.9G 4.5M 2.7G 1%/tmp
/dev/sr0 3.7G 3.7G 0 100%/media/centos_6.7_final
10.219.24.22:/oradata
35G 8.9G 25G 27%/mnt
6. Automatic mount on Boot
Method One:
[[email protected] ~]# echo "mount-t NFS 10.219.24.22:/oradata/mnt" >>/etc/rc.local

Method Two:
Open Netfs Service
[Email protected] ~]# chkconfig netfs on
[Email protected] ~]# Vi/etc/fstab
[Email protected] ~]# Cat/etc/fstab
10.219.24.22:/oradata/mnt NFS Defaults 0 0

7. Inspection
--NFS Server
[Email protected] ~]# TOUCH/ORADATA/AA
--Client
[Email protected] ~]# cd/mnt
[email protected] mnt]# LL
Total 0
-rw-r--r--. 1 root root 0 04:31 AA

NFS built under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.