Debian下nfs的安装和配置

#apt-get install portmap <-------------客户端和服务器的安装

#apt-get install nfs-kernel-server <-------------或者#apt-get install nfs-user-server

#apt-get install nfs-common

#mkdir -p /home/cody/arm210/roofs_qtopia_qt4 <-------------建立共享目录 

#vi /etc/export <-------------配置文件
add
/home/cody/arm210/roofs_qtopia_qt4        *(rw,sync,no_root_squas) <-------------nfs共享目录,它可以作为开发板的根文件系统通过nfs挂载。

下面是一些NFS共享的常用参数:
            ro                      只读访问
            rw                      读写访问
            sync                    所有数据在请求时写入共享
            async                   NFS在写入数据前可以相应请求
            secure                  NFS通过1024以下的安全TCP/IP端口发送
            insecure                NFS通过1024以上的端口发送
            wdelay                  如果多个用户要写入NFS目录,则归组写入(默认)
            no_wdelay               如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
            hide                    在NFS共享目录中不共享其子目录
            no_hide                 共享NFS目录的子目录
            subtree_check           如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
            no_subtree_check        和上面相对,不检查父目录权限
            all_squash              共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
            no_all_squash           保留共享文件的UID和GID(默认)
            root_squash             root用户的所有请求映射成如anonymous用户一样的权限(默认)
            no_root_squas           root用户具有根目录的完全管理访问权限
            anonuid=xxx             指定NFS服务器/etc/passwd文件中匿名用户的UID
            anongid=xxx             指定NFS服务器/etc/passwd文件中匿名用户的GID

#dpkg-reconfigure portmap <-------------对Should portmap be bound to the loopback address? 选N

#chmod 777 -R /home/cody/arm210/roofs_qtopia_qt4

#/etc/init.d/portmap restart
#/etc/init.d/nfs-kernel-server restart <-------------重启服务

测试:

cody@debian:/mnt$ sudo mount 192.168.1.6:/home/cody/arm210/rootfs_qtopia_qt4 /mnt/nfs
cody@debian:/mnt$ ls /mnt/nfs
bin   dev  home  linuxrc  opt   root  sys  usr  www
data  etc  lib   mnt      proc  sbin  tmp  var

 

在开发板上使用NFS的时候,按照开发板手册的步骤配置,到最后出现

nfs:server 192.168.1.6 is not responding,still trying

的错误,后来发现Linux命令行写错了网关,跟PC上配置的网关不一样,不能写192.168.1.1,而应该是写NFS server的IP

原来的命令行:

Linux-CommandLine = console=ttySAC0 root=/dev/nfs nfsroot=192.168.1.6://home/cody/arm210/rootfs_qtopia_qt4 ip=192.168.1.10:192.168.1.6:192.168.1.1:255.255.255.0:cody.hm:eth0:off

修改后:

Linux-CommandLine = console=ttySAC0 root=/dev/nfs nfsroot=192.168.1.6://home/cody/arm210/rootfs_qtopia_qt4 ip=192.168.1.10:192.168.1.6:192.168.1.6:255.255.255.0:cody.hm:eth0:off

就可以了,哎,自作聪明!

posted @ 2013-09-09 09:00  OpenUSB  阅读(9818)  评论(0编辑  收藏  举报