NFS Server

1./etc/exports

cat /etc/exports

/tftpboot/nfs 192.168.0.*(rw,sync,no_root_squash)

 

 

 

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

 

 

2. showmount -e: show mount information for an NFS server

 

3. mount -t nfs localhost:/nfs /mnt

 

4. 修改/etc/exports后exportfs -r: flush everything out of the kernels export table

 

5. Mounting a Filesystem over NFS hangs forever

Question:
We use the  SELF ramdisk image that comes with the  ELDK. When we try to mount a filesystem over NFS from the server, for example: 

# mount -t nfs 192.168.1.1:/target/home /home 

the command waits nearly 5 minutes in uninterruptable sleep. Then the mount finally succeeds. What's wrong?

 

Answer:
The default configuration of the  SELF was not designed to mount additional filesystems with file locking over NFS, so no portmap deamon is running, which is causing your problems. There are two solutions for the problem:
  1. Add the portmap deamon (/sbin/portmap) to the target filesystem and start it as part of the init scripts.
  2. Tell the "mount" program and the kernel that you don't need file locking by passing the "nolock" option to the mount call, i. e. use 

    # mount -o nolock -t nfs 192.168.1.1:/target/home /home

 

Explanation:
If you call the mount command like above (i. e. without the  "nolock" option) an RPC call to the  "portmap" deamon will be attempted which is required to start a  lockd kernel thread which is necessary if you want to use file locking on the NFS filesystem. This call will fail only after a  very long timeout.

7. Using NFSv3 for NFS Root Filesystem

Question:

My NFS server only allows the protocol in version 3. Even though my kernel has "NFS client support for NFS version 3" compiled in, I cannot use this as a root filesystem. The boot process stops like this:

Looking up port of RPC 100003/2 on 10.0.0.136

Looking up port of RPC 100005/1 on 10.0.0.136

Root-NFS: Server returned error -22 while mounting /opt/eldk/ppc_6xx

VFS: Unable to mount root fs via NFS, trying floppy.

VFS: Cannot open root device "nfs" or unknown-block(2,0)

Answer:

In addition to the kernel support, you need to specify the "nfsvers=3" option to use NFS protocol version 3 as a rootfilesystem. So include something like the following in your kernel commandline:

nfsroot=[<server-ip>:]<root-dir>,nfsvers=3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值