NFS network file system configuration

Nfs is the abbreviation of network file system, which means network file system. It is one of the file systems supported by FreeBSD, which allows the sharing of resources between computers on the network. Enable users to access files elsewhere on the network as if they were using their own computer. NFS is an application based on the UDP/IP protocol.

We generally use nfs to mount the file system and then develop.

Nfs configuration steps: The
development board is connected to the PC computer with a network cable.
Change the virtual machine network card to bridge mode
, shut down first -> virtual machine -> settings
Insert picture description here

Force the virtual machine's network to go out of the wired network
Edit -> Virtual Network Settings -> Click Change Settings -> Select a wired network card, as long as it is a wired network card, the name may be different from the following.
Insert picture description here
Execute commands in Ubuntu, download nfs

sudo apt install nfs-kernel-server

Create a directory root_nfs in Ubuntu first, as the directory for subsequent NFS mounting

/home/chao/work/project/Hisi3518E_V200/root_nfs

In Ubuntu, add the path to the nfs configuration file:

sudo vi /etc/exports   //打开该文件

Type in the last line

/home/chao/work/project/Hisi3518E_V200/root_nfs *(rw,sync,no_root_squash)

In Ubuntu, restart the NFS service

sudo /etc/init.d/nfs-kernel-server restart

In Ubuntu, in the root directory, open the interfaces file and configure the Ubuntu address

sudo vi /etc/network/interfaces

Fill in the last line

auto ens33
iface ens33 inet static
address 169.254.241.121
netmask 255.255.255.0
gateway 169.254.241.1

Restart Ubuntu, the above configuration will take effect after restarting.

Under the root file system of the development board, set the ip address so that it is on the same network segment as Ubuntu-241 network segment.
The Ubuntu address is 169.254.241.121,
so enter in the Linux console of the development board:

ifconfig eth0 169.254.241.126

At this point, the ip address has been set successfully, and then ping the address of Ubuntu in the Linux console of the development board

ping 169.254.241.121

It can be pinged.

Use the command to mount NFS to the /mnt directory on the Linux console of the development board

mount -t nfs -o nolock 169.254.241.121:/home/chao/work/project/Hisi3518E_V200/root_nfs /mnt

At this time, NFS has been successfully mounted, and Ubuntu has been connected with the development board through NFS.
Under Ubuntu

/home/chao/work/project/Hisi3518E_V200/root_nfs

Add a file 1.txt, then /mnt under the development board root file system also sees this file.

It shows that nfs is successfully mounted!

It is too troublesome to manually set ip and mount NFS every time you boot. We now need to let him automatically set ip and mount NFS automatically.
Under the development board root file system, modify the content of /etc/profile and add it to the last line

ifconfig eth0 169.254.241.126(设置ip)
mount -t nfs -o nolock 169.254.241.121:/home/chao/work/project/Hisi3518E_V200/root_nfs /mnt(挂载NFS)

Guess you like

Origin blog.csdn.net/qq_31885403/article/details/114149814
Recommended