1、介绍
Advantage of user-space NFS server is that it does not require kernel support. Also if it crashes — there is no crash of the system: just one process dies, not the kernel!
The disadvantage of user-space NFS server is its productivity: no one can be faster than in-kernel implementation.
It is impossible to outmatch in-kernel NFS servers from user-space, but UNFS3 should not lag too far behind.(性能有差距,但不能太大)
One well-known implementation of NFS server is "The LINUX User-Space NFS Server" by Olaf Kirch.
Some Linux distributions contain this package: Debian Sarge (nfs-user-server), OpenSUSE 10.0 (nfs-server).
Note that both unfs3 and nfs-user-server do not support file locking.
找到两个版本:
http://sourceforge.net/projects/unfs3/(UNFS3 user-space NFSv3 serve)-----unfs3-0.9.22.tar.gz
http://sourceforge.net/projects/unfs/(User Space NFS)-----nfs-server-2.2beta47.tar.gz
2、安装unfs3
chmod +x configure
./configure
make
make install
编译安装完成后只生成一个unfsd文件,位于/usr/local/sbin/目录下
3、使用unfs3
为了防止混淆,先卸载系统提供的nfs-kernel-server的rpm包,并卸载掉nfsd.ko模块
(1)还是要首先启动portmap:service portmap start,注意portmap没有内核态模块支持
(2)设置/etc/exports文件
/home (rw,no_root_squash)
"/with spaces" weirdo
/usr 1.2.3.4(rw) 192.168.2.0/24(ro,all_squash)
/home/foo bar(rw) 10.0.0.0/255.0.0.0(root_squash)
/home/joe joes_pc(anonuid=1100,anongid=1100,rw,all_squash)
(3)启动unfs的进程,./usr/local/sbin/unfsd,同时观察message信息
(4)showmount -e 11.11.11.5
(5)挂载:mount -t nfs 11.11.11.5:/tmp /mnt,同时观察message的信息
4、其他问题
如果修改了/etc/exports,需要kill掉unfsd,然后重新运行