Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does linux nfs mean?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Most people do not understand the knowledge of this article "what linux nfs refers to", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can gain something after reading this article. Let's take a look at this "what linux nfs refers to" article.

In linux, nfs refers to the "network file system", a file system that enables users to access the server; it can mount remote disks locally and use them as local disks. Through NFS, users and programs can access the files of remote systems as if they were local files. NFS uses Cramp S architecture, and the server needs to open the TCP2049 port.

The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

A brief introduction to NFS

NFS is a Network File System (Network File system), which is a file system that enables users to access the server. The main function is to share files or directories between different servers through the network.

NFS is a technology that allows remote disks to be mounted locally and used as local disks. With NFS, users and programs can access files on remote systems as if they were local.

The NFS uses the Cpact S architecture, and the server opens the TCP2049 port to wait for the client to connect.

II. Installation and startup of NFS

When installing NFS, because NFS is based on rpcbind, when installing NFS, you need to first install the rpcbind,NFS service installation command as follows:

Yum install-y rpcbind nfs-utils

Similarly, when starting, start rpcbind first, and then start NFS. The relevant commands are as follows:

Systemctl start rpcbindsystemctl start nfs-utils

After the NFS service starts, it listens on the local port 2049, as shown below:

III. Practical use of NFS

To set NFS, you first need to configure the client IP address and permissions that allow mounting on the server. You need to open the / etc/exports file and write it in the file:

/ nfs 192.168.136.101 (rw)

The previous / nfs indicates the directory to which the mount is allowed, and the latter 192.168.136.101 indicates the client to which the mount is allowed. You can also use * to indicate that any host is allowed to mount it, and rw indicates that the permission for mount is read-write permission.

In addition to rw permissions, other commonly used permissions are:

1. Ro-- indicates read-only permission

2. Sync-- means that data is written to memory and disk synchronously.

3. Async-- means that the data is first stored in memory rather than written directly to disk.

4. Secure-- indicates that NFS uses a port below 1024 when transferring files

5. Insecure-- indicates that NFS uses more than 1024 ports when transferring files

6. All_squash-- indicates that the UID and GID of the file are anonymous, which is suitable for shared directory configuration.

7. No_all_suash-- indicates the UID and GID of the reserved file

After you have done the above, you need to execute the command:

Exportfs-rv

Reread the configuration file of NFS.

Next, on the client, execute the mount command:

Showmount-e 192.168.136.210mount 192.168.136.210/nfs / media

You can mount the file successfully. After the file is mounted successfully, execute the command df-h to view the mount result, as shown below:

Note: before the mount operation, the firewall on the server must be turned off! Otherwise the mount will fail.

However, although it can be mounted successfully and has read and write permissions on the service configuration, in practice, the client may not have write permission to the mount directory. This is because there is a permission check problem in the server system. Since the NFS service is run by the user nfsnobody by default, and if the user does not have write permission to the / nfs directory, the client cannot write to the directory, so we need to grant write permission to the nfsnobody user, such as:

Chonw nfsnobody.nfsnobody-R / nfs

In this way, we can use the NFS file system as if we were mounted locally.

IV. NFS mount optimization

In the above scenarios, although we can mount NFS and achieve the desired results, in order to improve the reading and writing speed of NFS, we will not use the following mount command in actual scenarios:

Mount-t nfs-o noatime,nodiratime,rsize=131072,wsize=131072,intr 192.168.126.210:/nfs / media

In the above command, the-t parameter indicates that the target file system to be mounted is nfs,noatime to cancel the inode access time on the update file system, nodirtime indicates to cancel the directory inode access time on the update file system, and these two options can be used to improve system performance in high concurrency environments, and rsize and wsizei indicate the size of read and write chunks This setting value, UID, affects the amount of buffer storage written by the client and the server. In the case of high device performance, this value can be set a little higher to improve the file transfer ability of the NFS system.

The above is about the content of this article "what linux nfs refers to". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report