1.NFS
NFS is a Network File System that enables File sharing between different machines and systems over the Network. Through NFS, you can access a remote shared directory just as you can access a local disk. In embedded Linux development, the development board is often used to run programs on the target machine.
2. Set up the NFS server on the Linux host
2.1. Install the NFS server
sudo apt-get install nfs-kernel-server
Copy the code
2.2. Adding an NFS shared directory
After the NFS server is installed, specify the NFS directory for sharing.
2.2.1. Creating a shared directory
sudo mkdir /nfsroot
sudo chmod -R 777 /nfsroot
sudo chown -R nobody /nfsroot
Copy the code
2.2.2. Edit the configuration to specify the NFS shared directory
sudo vim /etc/exports
Copy the code
Add the NFS shared directory we specified at the end of the file:
/nfsroot *(rw,sync,no_root_squash)
Copy the code
Save the file and exit.
2.2.3. Starting the NFS service
sudo /etc/init.d/nfs-kernel-server start
Copy the code
Note: The NFS service is automatically started upon system startup.
3. Perform a self-test for an NFS client on the Linux host
3.1. Install an NFS client
sudo apt-get install nfs-common
Copy the code
3.2. Mount the NFS shared directory to another directory
Sudo mount -t NFS <Linux host IP address >:/nfsroot/MNT -o nolockCopy the code
3.3. View test results
Go to the /nfsroot shared directory and create a test folder:
sudo mkdir nfs_test
Copy the code
Then enter the/mnt
Directory to view:
4. Mount NFS on the Linux development board
Mount -t NFS <Linux host IP address >:/nfsroot/MNT -o nolockCopy the code
5. Problems encountered and solutions
After the NFS service is enabled on the cloud server, the NFS service can be mounted on the local server, but not on the development board. The following information is displayed:
Cause: An invalid port is used, that is, a port greater than 1024 is used.
Fix the problem: Modify the /etc/exports configuration file and add the insecure option to restart the NFS service.
Result: The mount is successful.