For NFS systems, we had a lot of experience in the past. We know that it is a protocol for file control in the network. Many storage functions are closely related to him. So today we will mainly explain how to set up the NFS service in CentOS 5.3.
Configure the Network File System CentOS 5.3 NFS service
Install NFS-related software when installing CentOS (also applicable to Fedora). If not, install the software before proceeding.
After installation, follow these steps to create and configure the NFS service.
First, disable the firewall selinux:
Modify the/etc/sysconfig/selinux file.
SELINUX = disabled
(1) set the shared directory of the CentOS 5.3 NFS service
Run commands
# Gedit/etc/exports
Edit the nfs service configuration file (Note: The file is empty when it is opened for the first time) and add the following content:
/Root/work/nfs * (rw, sync, no_root_squash)
Run the following command to make the above take effect:
#/Usr/sbin/exportfs-ra
Where:
/Root/work/nfs indicates the nfs shared directory, which can be mounted as the root file system of the Development Board through nfs
* Indicates that all clients can mount the directory.
Rw indicates that the Client Connected to this directory has the permission to read and write the directory.
No_root_squash indicates that the Client Connected to this directory is allowed to have the root identity of the host.
(2) start and stop the CentOS 5.3 NFS service
Run the following command line:
#/Etc/init. d/nfs start
Or: service nfs start
Mount nfs to the local directory to check whether the nfs service is started:
# Mount-t nfs localhost:/root/work/nfs/mnt/nfs
If no error message is displayed, the contents in the/mnt/nfs Directory are consistent with those in the/root/work/nfs directory.
Run the following command to stop the nfs service:
#/Etc/init. d/nfs stop
Or: service nfs start
You can enter
# RedHat-config-services
Open the system service configuration window, find the nfs service option box in the left column, select it, and save it to start the system.
(3) CentOS 5.3 NFS service usage
Set Fedora in the VM to bridge mode, restart, and set the IP address to 10.10.143.103. Run the following command to check the Configuration:
# Mount-t nfs-o nolock 10.10.143.103:/root/work/nfs/mnt/nfs
If it succeeds, you can use the above commands on the Development Board to mount it.
##################
Test command
Mount-t nfs localhost:/home/gs/work/ramdisk/mnt/ramdisk/
Mount-t nfs 10.10.143.103:/home/gs/work/ramdisk/mnt/ramdisk/
Mount-t nfs 10.10.143.103:/home/gs/work/nfs/mnt/nfs-o proto = tcp-o nolock
-------------------------------------------------------------
Nfs: server is not responding, still trying reason and Solution
The default NFS transmission protocol is UDP, and serious Nic packet loss occurs when the PC interacts with the embedded system through UPD. the available solution is to switch to the TCP protocol on the client and use the following command,
Mount-t nfs-o intr, nolock, tcp, rsize = 1024, wsize = 1024 10.10.143.103:/home/gs/work/nfs/mnt/nfs
Mount-t nfs-o nolock-o tcp 10.10.143.103:/home/gs/work/nfs/mnt/nfs
--------------------------------------------------------
Mount-t nfs-o intr, nolock, tcp, rsize = 1024, wsize = 1024 10.10.143.103:/root/work/busybox/rootfs_ipnc // mnt/nfs
Mount-t NFS-o nolock-o tcp 10.10.143.103:/home/gs/work/nfs/mnt/nfs