centos6.5 NFS File Server

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.

1. NFS Installation

# yum Insyall nfs-y

2. Server Configuration for NFS

Server for NFS is relatively simple to configure, just set it up in the appropriate configuration file, and then start Server for NFS.

Common Directories for NFS

/etc/exports Primary configuration file for NFS services

/USR/SBIN/EXPORTFS Management commands for NFS services

View commands for/usr/sbin/showmount clients

/var/lib/nfs/etab record full permission SetPoint for NFS-shared directory

/var/lib/nfs/xtab Logging of client information that has been logged on

The NFS service configuration file is/etc/exports, which is the primary NFS configuration file, but the system does not have a default value, so this file does not necessarily exist, it may be created manually using Vim, and then write the configuration content in the file.

# Vi/etc/exports

/DATA/192.168.1.110 (Rw,sync)//Allow 1.110 Client Access

Common ways for clients to specify

    • Specify the IP address of the host: 192.168.1.110

    • Specify all hosts in the subnet: 192.168.1.0/24 192.168.1.0/255.255.255.0

    • Host of the specified domain name: david.bsmart.cn

    • Specify all hosts in the domain: *.bsmart.cn

    • All hosts: *

Access Permissions Options

    • Set output Directory read-only: RO

    • Set output directory Read/write: RW

User mapping Options

    • All_squash: Maps all normal users and groups that are accessed remotely to anonymous users or user groups (Nfsnobody);

    • No_all_squash: Reverse with All_squash (default setting);

    • Root_squash: The root user and the owning group are mapped to anonymous users or groups of users (default setting);

    • No_root_squash: Reverse with Rootsquash;

    • ANONUID=XXX: Maps All remote access users to anonymous users and specifies that the user is a local user (uid=xxx);

    • ANONGID=XXX: Maps All remote Access user groups to anonymous user group accounts and specifies that the anonymous user group account is a local user group account (GID=XXX);

Other options

    • Secure: Restrict clients from connecting to Server for NFS (default setting) only from TCP/IP ports less than 1024;

    • Insecure: Allow clients to connect to the server from TCP/IP ports greater than 1024;

    • Sync: It is inefficient to write data synchronously to memory buffer and disk, but it can guarantee the consistency of data;

    • Async: Save the data in the memory buffer first, and write to disk if necessary;

    • Wdelay: Check if there is a related write operation, if any, then perform these writes together, which can improve the efficiency (default setting);

    • No_wdelay: If a write operation is performed immediately, it should be used in conjunction with sync;

    • Subtree: If the output directory is a subdirectory, the NFS server will check the permissions of its parent directory (default setting);

    • No_subtree: Even if the output directory is a subdirectory, the NFS server does not check the permissions of its parent directory, which can improve efficiency;

3. Start the NFS server

# Service Portreserve Restart

# service rpcbind Restart

# Service NFS Restart//These services sometimes system defaults are turned off by the recommended setting to boot Chkconfig

4. How the Linux client uses the NFS file system needs to be mounted on the client

# mount-t NFS 192.168.1.90:/data//mnt

5. Common commands

Server-side Query for NFS shared status using the Showmount command

# SHOWMOUNT-E//default view of their shared services, provided that the DNS can resolve their own, otherwise prone to error

# SHOWMOUNT-A//Displays directory information that has been connected to the client

Clients use the Showmount command to query the shared state of NFS

# SHOWMOUNT-E NFS Server IP

6. Automatically mount NFS file system on boot

# Vi/etc/fstab

Add format 192.168.1.90:/data//mnt/nfs defaults 0 0

This article is from the "icemin" blog, make sure to keep this source http://icemin.blog.51cto.com/11581342/1789534

centos6.5 NFS File Server

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.