When using Linux for embedded development, in order to facilitate development, the development Board is usually mounted on the host's file system, then the code is placed in the directory shared to the Development Board, and then run through the Development Board.
First check to see if the NFS software package is installed, yum List installed | grep NFS. If you are installing, you can set the following.
NFS server-side configuration:
1. Create a shared directory first: Create a share directory under the root directory. Execute Mkdir/share
2. Then edit the exports file: Vim/etc/exports
If you have not previously shared the Directory through NFS, the file is empty and fills in the following:
Copy Code
The code is as follows:
/share * (Sync,rw,no_root_squash)
Each part explains:
/share directory name for the external share of the confidential
* To allow external access to the IP address of the native shared directory.
Sync to save the data in a memory buffer before writing to the disk if necessary.
RW has read and write access to the local shared directory for external hosts
The No_root_squash matches the native user for the access user, and the match fails to be mapped to an anonymous user or user group.
The remaining options for the above sections are:
1-> The way the client is specified
Specifies the host of the IP address: 192.168.0.100
Specify all hosts in the subnet: 192.168.0.0/24 or 192.168.0.0/255.255.255.0
Host of the specified domain name: nfs.test.com
Specify all hosts in the domain: *.test.com
All hosts: *
2->. Option description
RO: Shared directory read-only;
RW: Shared directory readable and writable;
All_squash: All access users are mapped to anonymous users or groups of users;
No_all_squash (default): The Access user first matches the native user, the match fails and then maps to an anonymous user or user group;
Root_squash (default): Maps a visiting root user to an anonymous user or user group;
No_root_squash: The visiting root maintains root account privileges;
Anonuid= : Specifies the local user uid of the anonymous Access user, which defaults to Nfsnobody (65534);
Anongid= : Specifies the local user group GID for anonymous access users, which defaults to Nfsnobody (65534);
Secure (Default): Restricts clients from connecting to servers from TCP/IP ports less than 1024;
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 (default): Check whether there are related write operations, if there are these writes together to execute, can improve efficiency;
No_wdelay: If there is a write operation will be implemented immediately, should be used in conjunction with the sync;
Subtree_check (default): If the output directory is a subdirectory, the NFS server will check the permissions of its parent directory;
No_subtree_check: Even if the output directory is a subdirectory, NFS server does not check the permissions of its parent directory, you can mention
Efficient
3. Make settings effective: Exportfs-ra or service NFS restart
4. View shared directory output by command: exportfs-v
NFS Client Configuration:
The client can view the external shared directory of the remote server through SHOWMOUNT-E IP.
1. Start NFS Service
2. Set up the mount point, Mkdir/mnt/nfs
3. Mount: Mount-t NFS Ip:/share/mnt/nfs
4. Uninstall: Umount/mnt/nfs
The 3rd step of IP represents the host IP of the external shared directory, that is, the server IP. Here you can use localhost instead of an IP address to indicate that you are using NFS to mount your native directory to another directory
The mount information can be written to the/etc/fstab file to enable automatic mounting of the NFS service, in the following format:
Ip:/share/mnt/share NFS Defaults 0 0
which
Ip:/share for remote host IP address and shared directory
/mnt/share for the directory to be mounted to the local
NFS is a file system type
Defaults 0 0 for Mount Options
Use Mount | The grep NFS command displays the NFS directory mounted by the current host.
Unload a mounted directory: Umount/mnt/nfs
The above is a small set for everyone to share the Linux under the NFS server Building skills, I hope this article described to help.