Configuring NFS Services in the Ubuntu 14.04LTS environment

Source: Internet
Author: User
Tags parent directory

in short, NFS (network FileSystem, Web File system) is used to share files between different machines and different operating systems through the network. The design of NFS is designed to be used between different systems, so its communication protocol design is independent of the host and the operating system. NFS sub-servers and clients, when using remote files, you can mount the file system on the remote NFS server to the local file system with the Mount command, and the operation of the remote file is not different from the operation of the local file. The files or directories that are shared by the NFS server are recorded in the/etc/exports file. In embedded Linux development, NFS is often used, and the target system is typically used as an NFS client, and the Linux host acts as an NFS server. The NFS shared directory on the server is mounted locally on the target system via NFS, and the files on the server can be run directly. NFS is necessary to debug system driver modules and applications, and Linux also supports the NFS root file system, which can be booted directly from the remote NFS root system, which is also necessary for the embedded Linux root file system to be cropped and integrated, and is detailed in Ubuntu Steps to install NFS in a 14.04lts environment:

1, execute command: sudo apt-get install nfs-kernel-server, note that in this process the root user and non-root user can, see figure 2;

2, execute the command: Mkdir/home/hemingway/nfshemingway create a dedicated NFS service folder, this directory can be customized to choose, see Figure 2;

3, after the establishment of a good folder, then execute the command: sudo vi/etc/exports configuration nfs,nfs allow mount directory and permissions are defined in the file/etc/exports. For example, to share the/home/hemingway/nfshemingway directory under the root directory, you need to add the last line of the/etc/exports text: /home/hemingway/nfshemingway * (Rw,sync,no_root_squash,no_subtree_check), see Figure 1, in the NFS configuration file above:/ Home/hemingway/nfshemingway * (Rw,sync,no_root_squash,no_subtree_check) The meaning of this line is:
/home/hemingway/nfshemingway: directory shared with the NFS service client, this path must match the path of the file you set up earlier!
*: Allow all network segments to be accessed or use specific IP
RW: Clients hooking up this directory have read and write access to the shared directory
Sync : Data is written to memory and hard disk synchronously
No_root_squash:root User has full administrative access to the root directory
No_subtree_check: Do not check the permissions of the parent directory;

Figure 1

4. After modifying the above configuration file, save and exit;

5, execute the command:sudo/etc/init.d/rpcbind Restart Restart the Rpcbind Service, NFS is an RPC program, before using it, you need to map the port, through the Rpcbind settings, There is a difference between this and unbuntu12.04;

6, execution command: Sudo/etc/init.d/nfs-kernel-server restart restart NFS service;

7, test, use the command mount-t NFS localhost:/home/hemingway/nfshemingway/roots/mnt to mount it on the local disk, specifically, will /home/hemingway/nfshemingway/rootfs mount to/mnt , See if the mount is successful by using DF Bright, as shown in Figure 2.

Figure 2

Appendix: The Common Parameters for NFS are as follows:
RO read-only access
RW Read-Write access sync all data is written to share on request
Async NFS can respond to requests before writing data
Secure NFS is sent over a secured TCP/IP port below 1024
insecure NFS is sent over 1024 ports
Wdelay If multiple users are writing to the NFS directory, the group is written to (default)
No_wdelay If more than one user wants to write to the NFS directory, it is written immediately and does not require this setting when using Async.
Hide does not share its subdirectories in the NFS shared directory
No_hide subdirectories for shared NFS directories
Subtree_check If you share a subdirectory such as/usr/bin, Force NFS to check the permissions of the parent directory (default)
No_subtree_check and above, do not check parent directory permissions
All_squash shared file uid and GID mapping anonymous user anonymous, suitable for common directories.
No_all_squash Preserve the UID and GID of shared files (default)
Root_squash all requests from the root user are mapped to the same permissions as the anonymous user (default)
No_root_squas Root user has full administrative access to the root directory
anonuid=xxx Specifies the UID of the anonymous user in the NFS server/etc/passwd file;

reference : 1,http://www.linuxidc.com/Linux/2013-08/89154.htm;

Configuring NFS Services in the Ubuntu 14.04LTS environment

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.