LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Can't mount NFS as writeable (http://www.linuxquestions.org/questions/linux-server-73/cant-mount-nfs-as-writeable-857715/)

Mustafa Ismail Mustafa 01-21-2011 02:03 AM

Can't mount NFS as writeable
 
This is my first time working with NFS but I fail to see what the issue is since everything works properly.

On the server (CentOS 5.5, virtualized), /etc/exports has

Quote:

/home/share 192.168.0.0/16 *(rw, sync)
I've exported the file using
Quote:

exportfs -ra
Then mounting it from the client with

Quote:

sudo mount 192.168.2.105:/home/share /mnt/nfs
It mounts perfectly fine but I can't write to the mounted NFS partition.

Everytime I try "touch t", I get touch:
Quote:

cannot touch `t': Read-only file system
Anyone knows how I can mount this in a manner where I can write to the mount? Also, if I had explicitly mentioned that the partition is to be mounted as rw, why is this happening?


BTW, showmount -e 192.168.2.105 shows the proper value, namely,

Quote:

showmount -e 192.168.2.105
Export list for 192.168.2.105:
/home/share (everyone)

eSelix 01-21-2011 04:13 AM

Can you post result of commands
Code:

exportfs -v
mount

on the nfs server?
And
Code:

mount
on the client.

Mustafa Ismail Mustafa 01-21-2011 04:18 AM

Server:

Quote:

[root@centos01 ~]# exportfs -v
/home/share 192.168.0.0/16(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/home/share <world>(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@centos01 ~]# mount
/dev/sda5 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/sda3 on /home type ext3 (rw)
/dev/sda1 on /boot type ext2 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /proc/fs/vmblock/mountPoint type vmblock (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
client:
Quote:

[steve@steve-laptop:~]$ mount (01-21 12:17)
/dev/sda3 on / type ext3 (rw,relatime,errors=remount-ro)
proc on /proc type proc (rw)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
none on /var/lib/ureadahead/debugfs type debugfs (rw,relatime)
gvfs-fuse-daemon on /home/steve/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=steve)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)

tredegar 01-21-2011 05:45 AM

What is the output of ls -al /mnt ?

eSelix 01-21-2011 06:32 AM

I mean mounts on client after mounting nfs:
Code:

sudo mount 192.168.2.105:/home/share /mnt/nfs
mount


Mustafa Ismail Mustafa 01-21-2011 02:07 PM

@tredegar

Quote:

ls -al /mnt
total 12
drwxr-xr-x 3 root root 4096 2011-01-21 22:01 .
drwxr-xr-x 24 root root 4096 2011-01-21 21:22 ..
drwxr-xr-x 2 nobody nogroup 4096 2011-01-20 19:36 nfs

@eSelix

Sorry:

Quote:

mount
/dev/sda3 on / type ext3 (rw,relatime,errors=remount-ro)
proc on /proc type proc (rw)
none on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
none on /dev type devtmpfs (rw,mode=0755)
none on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
none on /dev/shm type tmpfs (rw,nosuid,nodev)
none on /var/run type tmpfs (rw,nosuid,mode=0755)
none on /var/lock type tmpfs (rw,noexec,nosuid,nodev)
none on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
gvfs-fuse-daemon on /home/steve/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=steve)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
192.168.2.105:/home/share on /mnt/nfs type nfs (rw,addr=192.168.2.105)
Thanks guys

eSelix 01-21-2011 03:25 PM

You have
Code:

/home/share 192.168.0.0/16(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)

/home/share <world>(rw,wdelay,no_root_squash,no_subtree_check,anonuid=65534,anongid=65534)

Are you (client) in 192.168.0.0/16 subnet?
If yes, you get read only filesystem, I think the second entry <world> is not getted then into account.

Mustafa Ismail Mustafa 01-21-2011 03:29 PM

Holy!

I didn't realize that! Yes my client is in the 192.168.0.0/16 subnet. How would I go about solving this? As you can see from the original post, its set to rw.

eSelix 01-21-2011 04:36 PM

Just set your /etc/exports like that:
Code:

/home/share 192.168.0.0/16(rw,sync)
if you do not want people outside your subnet to connect. And set permissions to /home/share that user with id=65534 which is usualy "nobody" has write permission, for example
Code:

chmod 777 /home/share
if you don't need special security. Or change anonuid option in exports file to other user id.

Mustafa Ismail Mustafa 01-22-2011 01:35 AM

Nope, still no go.

Changed the folder privileges to 777, mounted, unmounted and tried again and still won't write to the share. Checking from the client, ls -al gives me:

Quote:

total 12
drwxr-xr-x 3 root root 4096 2011-01-21 22:01 .
drwxr-xr-x 24 root root 4096 2011-01-22 08:46 ..
drwxrwxrwx 2 nobody nogroup 4096 2011-01-20 19:36 nfs
which explicitly states that all have rwx, but still won't write

Quote:

[steve@steve-laptop:/mnt/nfs]$ ls -al /mnt
total 12
drwxr-xr-x 3 root root 4096 2011-01-21 22:01 .
drwxr-xr-x 24 root root 4096 2011-01-22 08:46 ..
drwxrwxrwx 2 nobody nogroup 4096 2011-01-20 19:36 nfs
[steve@steve-laptop:/mnt/nfs]$ touch t.txt
touch: cannot touch `t.txt': Read-only file system

eSelix 01-22-2011 06:42 AM

Can you check "exportfs -v" on the server that there are really "rw" access?

Mustafa Ismail Mustafa 01-22-2011 07:07 AM

Hmm, you're right.

Check this out (all on the server):


Quote:

[root@centos01 ~]# exportfs -v
/home/share 192.168.0.0/16(ro,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
/home/share <world>(rw,wdelay,root_squash,no_subtree_check,anonuid=65534,anongid=65534)
[root@centos01 ~]# cat /etc/exports
/home/share 192.168.0.0/16 (rw,sync)
[root@centos01 ~]#
Why is this being exported as ro when its explicitly mentioned as rw??

I know that this shouldn't come into play, but just in case, the server is a virtual machine. That has nothing to do with it, right?

eSelix 01-22-2011 07:16 AM

You have space between IP and parenthesis
Code:

/home/share 192.168.0.0/16 (rw,sync)
it should be without any space like this
Code:

/home/share 192.168.0.0/16(rw,sync)

Mustafa Ismail Mustafa 01-22-2011 07:19 AM

Yay!

Many many thank yous! Shukran! Mucho Gracias! It works like a charm now :)

I'm surprised that that space was the cause of all of this!

Now to mark this as solved.


All times are GMT -5. The time now is 11:59 PM.