Platform Establishment and Application of NFS servers

Source: Internet
Author: User
Tags ftp protocol

NFS servers are widely used. This service is required for file sharing in many communications. Today we will explain how to build and use NFS servers in multiple systems. I hope to help you understand this aspect.

NFS Introduction

Developed by SUN, NFS has become a standard for file services (RFC1904, RFC1813 ). its biggest function is to allow computers of different operating systems to share data over the network, so it can also be viewed as a file server, as shown in Figure 1-1. NFS provides communication between Windows, Linux, and UNIX and Linux in addition to Samba.

Figure 1-1 NFS can be used as a file server

The client PC can mount the directory provided by the NFS server. After mounting, the directory looks like a local disk partition, you can use cp, cd, mv, rm, df, and other disk-related commands. NFS has its own protocol and port number, but when transmitting data or other related information, the NFS server uses a Remote Procedure Call, RPC) to assist the running of NFS servers.

Why NFS?

NFS aims to allow computers to share resources. In 1980s, the computer industry developed rapidly. Low-Cost CPU and client/server technologies have promoted the development of the distributed computing environment. however, when the processor price drops, the price of large-capacity storage systems remains high. therefore, a certain mechanism must be used to make full use of the performance of a single processor while allowing the computer to share storage resources and data, so NFS came into being.

NFS Protocol

With NFS, the client can transparently access the file system on the server, which is different from the FTP protocol that provides file transmission. FTP will generate a complete copy of the file. NFS only accesses part of the file referenced by one process, and the purpose is to make the access transparent. this means that any client program that can access a local file can access an NFS file without any modification.

NFS is a client/server application constructed using SunRPC. Its client sends an RPC request to an NFS server to access the files. although this work can be implemented by a general user process, that is, the NFS client can be a user process that explicitly calls the server, and the server can also be a user process. NFS is generally not implemented in this way for two reasons. first, access to an NFS file must be transparent to the client. Therefore, NFS client calls are performed by the client operating system on behalf of the user process. Secondly, for efficiency considerations, the NFS server is implemented in the server operating system. if the NFS server is a user process, each client request and server response includes read and write data) will have to switch between the kernel and the user process, which is too costly. the NFS 3rd Protocol was released in 1993. Figure 1-2 shows a typical structure of an NFS client and an NFS server.

Typical Structure of NFS clients and NFS servers

1) accessing a local file or an NFS file is transparent to the client. When the file is opened, it is determined by the kernel. after the file is opened, the kernel passes all references to the local file to the "local file access" box, pass all references to an NFS file to the box named "NFS client.

2) the NFS client sends RPC requests to the NFS server through its TCP/IP module. NFS mainly uses UDP, and the latest implementation can also use TCP.

3) the NFS server receives client requests as UDP packets on port 2049, although NFS can be implemented as a port er, allowing the server to use a temporary port, however, most implementations directly specify UDP port 2049.

4) when the NFS server receives a client request, it passes the request to the local file access routine and then accesses a local disk file on the server host.

5) It takes a certain amount of time for the NFS server to process a client request. It usually takes some time to access the local file system. during this interval, the server should not block requests from other clients. to implement this function, most NFS servers are multi-threaded. In fact, multiple NFS servers are running in the NFS lock management program, the specific implementation depends on different operating systems. since most UNIX kernels are not multi-threaded, a common technology is to start multiple instances of a user process, often known as "nfsd. this instance executes a system call and keeps it as a kernel process in the kernel of the operating system.

6) on the client host, it takes some time for the NFS client to process a user process request. the NFS client sends an RPC call to the server host and waits for the server to respond. to provide more concurrency for user processes on NFS client hosts, multiple NFS clients are generally run in the client kernel, and the specific implementation also depends on the operating system.

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.