linux nfs Read-only file system

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
root@pts/4 # touch 1
touch: cannot touch `1': Read-only file system
mount没有权限?
root@pts/0 # mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.0.71:/vol/vol2 on /share type nfs (rw,addr=192.168.0.71)
/dev/sdb1 on /backup type xfs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
192.168.3.150:/tmp/sem on /tmp/sem type nfs (rw,vers=4,addr=192.168.3.150,clientaddr=192.168.2.127)
是rw权限。什么情况?
看下权限,755,没有问题啊
root@pts/4 # ll
total 16
drwxr-xr-x 4 root root 4096 Dec  3 11:30 client
drwxr-xr-x 2 root root 4096 Dec 25 15:17 flash
drwxr-xr-x 6 root root 4096 Dec  3 16:46 touch
drwxr-xr-x 7 root root 4096 Dec  3 15:47 web
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
赋值777权限试试?
root@pts/4 # chmod -R 777 /tmp/sem/
chmod: changing permissions of `/tmp/sem/client': Read-only file system
chmod: changing permissions of `/tmp/sem/flash': Read-only file system
chmod: changing permissions of `/tmp/sem/web/model2': Read-only file system
服务器的文件系统损坏了?验证下
root@pts/1 # mkdir 1
192.168.3.150 [/tmp/sem] 2014-12-26 12:08:18
root@pts/1 # ls
1  client  flash  touch  web
服务器端没有问题啊。
难道是nfs问题吗?
root@pts/1 # vim /etc/exports
/tmp/htdocs/sem * (rw)
没有看出来,重启下nfs试试?
192.168.3.150 [/www/youyuan.com.1/htdocs/sem] 2014-12-26 12:49:59
root@pts/1 # /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:  exportfs: No options for /www/youyuan.com.1/htdocs/sem *: suggest *(sync) to avoid warning
exportfs: No host name given with /www/youyuan.com.1/htdocs/sem (rw), suggest *(rw) to avoid warning
exportfs: incompatible duplicated export entries:
exportfs:       *:/www/youyuan.com.1/htdocs/sem (0x424) [IGNORED]
exportfs:       *:/www/youyuan.com.1/htdocs/sem (0x425)
                                                           [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
报配置文件有误,*和(rw)之间不能有空格。
修正下吧,“*”范围太大了
root@pts/1 # vim /etc/exports
/tmp/htdocs/sem 192.168.0.0/22(rw,sync,no_root_squash)
重启nfs:
root@pts/1 # /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
客户端在试一下?
root@pts/4 # touch 1
touch: cannot touch `1': Permission denied
这次报访问拒绝,这个是与权限相关的,再次赋值777试试?
root@pts/4 # touch 1
192.168.0.193 [/tmp/sem] 2014-12-26 13:01:47
root@pts/4 # ls
1  client  flash  touch  web
root@pts/4 # rm 1
可以了,修正权限为755
root@pts/4 # touch 1
192.168.0.193 [/tmp/sem] 2014-12-26 13:02:14
root@pts/4 # ls
1  client  flash  touch  web
问题解决;

本文出自 “linux系统维护” 博客,请务必保留此出处:http://linuxadmin.blog.51cto.com/2683824/1596198


如果给你带来帮助,欢迎微信或支付宝扫一扫,赞一下。