Linux NFS (1) Basic concepts

Source: Internet
Author: User

NFS is the abbreviation for the network file system, which is the web filesystem. A contract for the decentralized file system, developed by Sun, was announced in 1984. The function is to enable different machines, different operating systems to share individual data with each other, so that the application can access the data on the server disk through the network, and it is a way to implement disk file sharing among Unix-like systems.

The basic principle of NFS is to "allow different clients and services to share the same file system through a set of RPC", which is independent of the operating system, allowing different hardware and operating systems to share files together.

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 some other transport protocols. And these transport protocols are used for this RPC function. It can be said that NFS itself is a program that uses RPC. Or, NFS is also an RPC SERVER. So whenever you use NFS, you start the RPC service, whether it's NFS server or NFS CLIENT. This allows the server and client to implement the program port correspondence via RPC. You can understand the relationship between RPC and NFS: NFS is a file system, and RPC is responsible for the transfer of information.

Port number for NFS:

TCP 2049

UDP 2049

NFS-related configuration files:

/etc/exports #主配置文件

How NFS Works:

NFS works by using the client/server architecture, which consists of a client program and a server program. The process of a server program providing access to a file system to other computers is called "output." The NFS client program "transports" them from the NFS server when accessing the shared file system. Files are typically transferred in "blocks" units. Its size is 8K (although it may divide the operation into smaller-sized shards). Nfs.

The configuration format for NFS is as follows:


[Email protected] ~]# vim/etc/exports

Shared directory client address (parameters, parameters)

--------------------------------------------

Client Address

IP Address: 192.168.4.20

Network segment Address: 172.0.0.0/24 or 172.0.0.*

All hosts: *

Single domain: *.tarena.com

Host Name: pc110.tarena.com

The arguments in parentheses.

RW: Read-only

RO: Readable and writable

Sync, Async: Synchronous write, asynchronous write

No_root_squash: Retains root privileges from the client

All_squash: Client permissions are reduced to Nfsnobody


For example, this example is to share home/home with all the hosts in the 192.168.0.0 network segment.

[Email protected] ~]# vim/etc/exports

/Home 192.168.0.0/24 (Ro,sync)

NFS View:showmount

- E view NFS Share list

- A check for NFS usage

[Email protected] ~]# showmount-E

[Email protected] ~]# showmount-R


How to start NFS and how to turn it off:

Note: This is started with an absolute path.

[Email protected] ~]# /etc/init.d/portmap Restart

[Email protected] ~]# /etc/init.d/nfs Restart

Turn off NFS:

[[email protected] ~]# /etc/init.d/nfs Stop

NFS Join boot entry:

[[email protected] ~]# chkconfig NFS on

This article is from the "Dragon" blog, make sure to keep this source http://1208073155.blog.51cto.com/9039381/1426540

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.