CentOS NFS File Sharing configuration

Source: Internet
Author: User

First, NFS installation, configuration

Yum-y Install nfs-utils nfs-utils-lib rpcbind

Mkdir-p/home/network/nfs

Vim/etc/exports

Increase

/home/network/nfs * (Rw,sync,no_root_squash,no_all_squash)

Save exit

Exportfs-r

Service Rpcbind Restart
Service NFS Restart

Chkconfig--level NFS On

Chkconfig--level Rpcbind on

Server-side authentication NFS Sharing:

Showmount-e

Note: Normal can display the above set of shared directories, if reported the following error:

Clnt_create:RPC:Program not registered

Description Rpcbind Service and NFS service boot sequence is not correct, put them both stopped, reboot, start the Rpcbind service before starting the NFS service;

Client Authentication NFS Share:

Showmount-e 192.168.1.207 (that is, the IP address of the NFS server)

Note: Normal can also display the above set of shared directories, if reported as follows error:

Clnt_create:RPC:Port mapper failure-unable to Receive:errno 113 (No route to host)

The firewall does not open the corresponding need to open the port, the firewall turned off, and then the test should be normal; however, the firewall is more important, under normal circumstances, will not be arbitrarily closed, the server can open the following commands listed in all the ports can be:

# rpcinfo-p localhost

second, the client Mount

Cd

mkdir Testnfs

Mount-t NFS 192.168.1.207:/home/network/nfs Testnfs

Verifying NFS Mounts

Df

Normal can show more than red font content:

File system 1k-block already used available% mount point
/dev/sda3 50403012 1772272 46070384 4%/
Tmpfs 914652 0 914652 0%/dev/shm
/DEV/SDA1 198337 27655 160442 15%/boot
192.168.1.207:/home/network/nfs
13383232 538944 12164480 5%/root/testnfs

Or

Cd/root/testnfs

mkdir test

Then to the server/home/network/nfs directory, whether a test folder can be found;

To set the system startup auto Mount:

Vim/etc/fstab

New

192.168.1.207:/home/network/nfs/root/testnfs NFS Defaults 0 0

third, knowledge expansion

Exports command:

The parameters are described below.
(1)-A: all mounts (or unloads) the settings in the/etc/exports file.
(2)-R: Re-mount the settings in/etc/exports, and update the contents of/etc/exports and/var/lib/nfs/xtab synchronously.
(3)-u: Uninstall a directory.
(4)-V: Displays the shared directory on the screen at export time.

/etc/exports File Content format:

< shared directory > [Client 1 options (access rights, user mappings, others)]

User mapping Options

All_squash: All normal users and groups of remote access are mapped to anonymous users or groups of users (Nfsnobody);

No_all_squash: Reverse with All_squash (default setting);

Root_squash: Maps root and group to anonymous users or groups of users (default setting);

No_root_squash: With the Rootsquash to take the opposite;

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

ANONGID=XXX: Maps All user groups for remote access to anonymous user group accounts and designates the anonymous user group account as the local user group account (GID=XXX);

Other options

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

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

Sync: Data synchronization to memory buffer and disk, inefficient, but can ensure the consistency of data;

Async: Save the data in a memory buffer before writing to disk if necessary;

Wdelay: Check for write-related writes and, if so, execute them together, which can improve efficiency (default setting);

No_wdelay: If there is a write operation will be implemented immediately, should be used in conjunction with the sync;

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

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

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.