[原]一个空格导致NFS的Read-only

      近日折腾Oracle 11g的Direct NFS Client遇到一个比较奇怪的问题,现象如下:

[root@test01 test02]# mount 192.168.0.202:/nfs/vol01 /nfs/test02/vol01/  
[root@test01 vol01]# cd vol01
[root@test01 vol01]# ls -lth
total 0
[root@test01 vol01]# mkdir xxx.txt
mkdir: cannot create directory `xxx.txt': Read-only file system
-rwxrwxrwx 1 root root 0 Nov 20 23:55 nothing.txt
[root@test01 vol01]# echo "" > nothing.txt 
-bash: nothing.txt: Permission denied

      简单来说就是mount了NFS始终为 read only。一开始怀疑是mount方式不对,经检查否定了这个猜想:

[root@test01 network-scripts]# cat /etc/mtab 
/dev/mapper/VolGroup00-LogVol00 / ext3 rw 0 0
proc /proc proc rw 0 0
sysfs /sys sysfs rw 0 0
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
/dev/cciss/c0d0p1 /boot ext3 rw 0 0
tmpfs /dev/shm tmpfs rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
/mnt/DB_X86_64_Linux_11.2.0.2.iso /mnt/oracle_11.2.0.2 iso9660 rw,loop=/dev/loop0 0 0
192.168.0.202:/nfs/vol01 /nfs/test02/vol01 nfs rw,addr=192.168.0.202 0 0

[root@test01 network-scripts]# mount -l
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/cciss/c0d0p1 on /boot type ext3 (rw) [/boot]
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
/mnt/DB_X86_64_Linux_11.2.0.2.iso on /mnt/oracle_11.2.0.2 type iso9660 (rw,loop=/dev/loop0) [20100917_105055]
192.168.0.202:/nfs/vol01 on /nfs/test02/vol01 type nfs (rw,addr=192.168.0.202)

      这证明客户端的挂载没有什么,检查服务器端:

[root@test02 sysconfig]# showmount -e 
Export list for test02:
/nfs/vol01 (everyone)
[root@test02 sysconfig]# exportfs -rv
exportfs: No options for /nfs/vol01 *: suggest *(sync) to avoid warning
exportfs: No host name given with /nfs/vol01 (rw,async,insecure), suggest *(rw,async,insecure) to avoid warning
exporting :/nfs/vol01
exporting *:/nfs/vol01

      怎么export了两个目录呢?检查 /etc/exports:原来多了个空格:

[root@test02 sysconfig]# cat /etc/exports    
/nfs/vol01 * (rw,async,insecure)
            ^ 这里多了个空格。

      将这个空格去掉,再重启nfs服务,或者 export –rv 就好了。

posted @ 2010-11-21 11:58  killkill  阅读(6662)  评论(0编辑  收藏  举报