天天看點

制作NFS檔案系統

制作NFS檔案系統

首先,要配置虛拟機上的linux支援nfs,配置共享目錄,通過 cat /etc/exports可以檢視共享目錄。在配置linux核心時,要選擇支援nfs。

在最開始,讓u-boot的環境變量為:set bootargs noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0 ,保證yaffs2系統可以正常運作。

然後再修改環境變量:set bootargs noinitrd root=/dev/nfsnfsroot=192.168.1.132:/share/first_fs ip=192.168.1.17:192.168.1.132:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC0 。

root=/dev/nfs(root=/dev/mtdblock3) 是指核心引導的檔案系統,在nfs目錄或者yaffs2。

nfsroot=xxx 是指虛拟機linux的IP位址和nfs共享目錄,如果希望檔案系統從改目錄挂載,則加上檔案系統名,入first_fs(busybox直接make生成的,外加一下目錄配置,并非yaffs2)。

Ip=xxx 是指開發IP:虛拟機linux的IP:網關:子網路遮罩::網卡:關閉  。

如果用這條引導指令:set bootargs noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0

則,進入檔案系統後用指令挂載:mount -t nfs -o nolock 192.168.1.132:/share /mynfsc

Linux的IP共享目錄   開發闆的nfs共享目錄。

如果在mount過程中出現錯誤提示:mount: 192.168.1.132:/share failed, reason given by server: Permission denied  。那麼在虛拟機linux執行指令,授予權限

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

先配置開發闆IP

ifconfig eth0 192.168.1.10 up

ifconfig eth0 up

ping 192.168.1.132 (虛拟機linuxIP)

如果不先配置eth0的IP,否則會出現這個錯誤

# mount -t nfs -o nolock 192.168.1.132:/share  /mynfsc

mount: RPC: Unable to send; errno = Network is unreachable

繼續閱讀