服务器端:
# 安装NFS服务
sudo apt-get install nfs-kernel-server
# 新建一个文件夹作为共享文件夹
mkdir /home/lsf/lsf_nfs_root
# 添加NFS共享目录
sudo gedit /etc/exports
# 若需要把 “/home/lsf/lsf_nfs_root 目录设置为 NFS 共享目录,请在该文件末尾添加下面的一行,并保存
# /home/lsf/lsf_nfs_root *(rw,sync,no_root_squash)
# * 表示允许任何网段的网络访问
# 开启NFS服务,下面两条都可以
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/nfs-kernel-server start
嵌入式端:
1、配置网络部分,主要是使能CONFIG_IP_PNP以在2中能够看到Root file system on NFS选项
Networking support
Networking options
TCP/IP networking
IP: kernel level autoconfiguration
[*] IP: DHCP support
[*] IP: BOOTP support
2、配置开启nfs服务
File systems --->
Network File Systems --->
<*> NFS client support
[*] NFS client support for NFS version 3 [*] NFS client support for the NFSv3 ACL protocol extension
[*] NFS client support for NFS version 4 (EXPERIMENTAL)
[*] NFS client support for NFSv4.1 (DEVELOPER ONLY)
[*] Root file system on NFS
配置完成后,编译、重新烧录kernel。
进入系统后,进行挂载:
mount -t nfs -o nolock 192.168.0.139:/home/nigel/nfs /mnt/nfs/
引用: