[原]一個空格導致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 就好了。
浙公網安備 33010602011771號