When using Linux for embedded development, for ease of development, it is common to attach the board to the host's filesystem, and then place the code in a directory that is shared with the board and then run through the Development Board.
First check to see if the NFS package is installed, yum List installed | grep NFS. If installed, the following settings are available.
Server-side Configuration for NFS:
1. First create a shared directory: Create the share directory under the root directory. Executive 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, fill in the following content:
/share * (Sync,rw,no_root_squash)
Each part explains:
/share directory name for this confidential external share
* To allow external access to the IP address of the native shared directory.
Sync is to save the data in the memory buffer first, and then to write to the disk if necessary.
RW has read and write access to the local shared directory for the external host
No_root_squash matches the native user to the access user, and the match fails before it is mapped to an anonymous user or user group.
The remaining options in the previous sections are:
1->. How the client is specified
Specify the IP address of the host: 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: The shared directory can be read and writable;
All_squash: All access users are mapped to anonymous users or user groups;
No_all_squash (default): The Access user first matches the native user, the match fails and then maps to the anonymous user or user group;
Root_squash (default): Maps the visiting root user to an anonymous user or user group;
No_root_squash: The root user has the root account privileges;
ANONUID=<UID>: Specifies the local user UID of the anonymous access user, which defaults to Nfsnobody (65534);
Anongid=<gid>: Specifies the local user group of the anonymous Access user GID, default is Nfsnobody (65534);
Secure (default): Restricts the client from connecting to the server 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 (default): Check if there is a related write operation, if any, will be executed together, can improve efficiency;
No_wdelay: If a write operation is performed immediately, it should be used in conjunction with 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, Server for NFS does not check the permissions of its parent directory, you can mention
Efficient
3. Make the 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 the SHOWMOUNT-E IP.
1. Start the 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, which is the server IP. You can use localhost instead of an IP address to indicate that the native directory is mounted to another Directory with NFS
Mount information can be written to the/etc/fstab file for automatic mounting of NFS services in the following format:
Ip:/share/mnt/share NFS Defaults 0 0
which
Ip:/share the IP address and shared directory of the remote host
/mnt/share is the directory to mount to the local
NFS is file system type
Defaults 0 0 for Mount option
Using Mount | The grep NFS command displays the NFS directory mounted by the current host.
Uninstalling a mounted directory: Umount/mnt/nfs
Linux to build NFS server