NFS: Network File System

Source: Internet
Author: User
Tags nfsd
Article title: NFS: Network File System. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

NFS server can be considered as a file server. it allows your PC to MOUNT the files shared by the remote nfs server to its own system through the network, in the CLIENT's view, remote files using NFS are like local files.

The NFS protocol has been available in multiple versions since its birth, such as NFS V2 (rfc1094) and NFS V3 (rfc1813) (the latest version is V4 (rfc3010 ).

II. main differences between NFS protocol versions

Major differences between V3 and V2:

1. file size

V2 supports up to 32 bit file sizes (4 GB), while NFS V3 supports 64 bit file sizes.

2. file transfer size

V3 does not have a limited transmission size. V2 can only be set to 8 kB at most. you can use-rsize and-wsize to set it.

3. complete information is returned

V3 has added and improved the return of many errors and successful information, which can bring great benefits to server settings and management.

4. added support for TCP transmission protocol

V2 only provides support for the UDP protocol, which has great limitations in some demanding network environments. V3 has added support for the TCP protocol.

* 5. asynchronous writing

6. improved SERVER mount performance

7. better I/O WRITES performance.

9. enhanced network operation efficiency, making network operation more effective.

10. better disaster recovery functions.

Asynchronous write feature (new in v3:

Whether NFS V3 can be written asynchronously is an optional feature. The NFS V3 client sends an asynchronous write request to the server. before replying to the client, the server does not have to write data to the memory (stable ). The server can determine when to write data or aggregate and process multiple write requests, and then write data. The client can maintain a copy of the data, in case the server cannot completely write the data. When the client wants to release this copy, it will use this operation process to the server to ensure that each operation step is complete. Asynchronous writing allows the server to determine the best data synchronization policy. Make sure that the data can be submitted synchronously as much as possible. Compared with V2, this mechanism can better achieve data buffering and more parallel (balanced ). The NFS V2 SERVER cannot write data to the storage before writing data to the storage.

V4 compared with V3:

1: improved access and execution efficiency on the INTERNET

2: enhanced security features in protocols

3: enhanced cross-platform features

III. specific operations and settings of the CLIENT and SERVER

Before talking about the operation of nfs server, let's look at some things related to nfs server:

RPC (Remote Procedure Call)

NFS itself does not provide information transmission protocols and functions, but NFS allows us to share data over the network, because NFS uses some other transmission protocols. These transport protocol Warriors use this RPC function. NFS itself is a program that uses RPC. NFS is also an rpc server. Therefore, the RPC service must be started wherever NFS is used, whether it is an nfs server or an nfs client. In this way, the SERVER and CLIENT can implement the corresponding program port through RPC. We can understand the relationship between RPC and NFS in this way: NFS is a file system, while RPC is responsible for information transmission.

DAEMONS to be started for NFS

Pc. nfsd: mainly used to detect complex logon permissions.

Rpc. mountd: responsible for the NFS file system. when the CLIENT logs on to the SERVER through rpc. nfsd, it manages the files accessed by clinet.

Nfs server requires two packages on the redhat linux platform: nfs-utils and PORTMAP.

Nfs-utils: provides two nfs daemons suites: rpc. nfsd and rpc. mountd.

Portmap: NFS can be regarded as an rpc server program. to start an rpc server program, you must do the corresponding work of the PORT, and such a task is completed by PORTMAP. In general, PortMap is used for PORT mapping.

I. server-side settings (taking LINUX as an example)

Server-side settings are all set in the/etc/exports file. the format is as follows:

Directory host name 1 or IP1 (parameter 1, parameter 2) host name 2 or IP2 (parameter 3, parameter 4)

The above format indicates that the same directory is shared to two different hosts, but the permissions and parameters provided to the two hosts are different. Therefore, the permissions obtained by the two hosts are set separately.

You can set the following parameters:

Rw: read/write permission;

Ro: Read-only permission;

No_root_squash: if the user logging on to the NFS host is a ROOT user, the user has the ROOT permission. this parameter is insecure and is not recommended.

Root_squash: Are you logged on to the NFS master? C. What is the purpose of sharing? If the user is root? R, then ???? User's? Why? Why? Why? Too many? Why? Shard K ?? UID? GID all ??? Into nobody, then ?? Identity;

All_squash: no matter what users log on to the NFS host, they will be reset to nobody.

Anonuid: sets all users logging on to the NFS host to the specified user id, which must exist in/etc/passwd.

Anongid: same as anonuid,? Group ID!

Sync: Data is synchronized to the storage.

Async: The data is temporarily stored in the memory and not directly written to the hard disk.

Insecure allows unauthorized access from this machine.

For example, you can edit/etc/exports as follows:

/Tmp * (rw, no_root_squash)

/Home/public 192.168.0. * (rw) * (ro)

/Home/test 192.168.0.100 (rw)

/Home/linux * .the9.com (rw, all_squash, anonuid = 40, anongid = 40)

After setting, run the following command to start NFS:

/Etc/rc. d/init. d/portmap start (PORTMAP is started by default in REDHAT)

/Etc/rc. d/init. d/nfs start

[1] [2] [3] [4] Next page

Related Article

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.