NFS: Read-only file system ?


Recommended Posts

After upgrading to unRAID 6 (fresh install), I no longer have a write permission on the NFS mount.

 

on the Media share setting in unRAID, NFS rule: 192.168.1.12(rw)

 

on Linux VM, I have executed the following command:

 

sudo mount 192.168.1.11:/mnt/user/Media/ /mnt/unraid/

 

I can see all my files on /mnt/unraid/

 

I have checked it has been mounted:

192.168.1.11:/mnt/user/Media/ on /mnt/unraid type nfs (rw,addr=192.168.1.11)

 

When I try to create a dir:

cd /mnt/unraid/Movies/

mkdir testing

 

Then I get an error: mkdir: cannot create directory ‘testing’: Read-only file system

 

Edit:

 

on unRAID I executed this command:

 

root@Tower:/mnt/user/Media# exportfs -v

/mnt/user/Media

                192.168.1.12(ro,async,wdelay,root_squash,no_subtree_check,fsid=100,sec=sys,ro,root_squash,no_all_squash)

 

It showing ro which should be rw?

 

However, when I look open /etc/exports 

 

"/mnt/user/Media" -async,no_subtree_check,fsid=100 192.168.1.12(rw)

 

 

 

Link to comment
  • 2 weeks later...

I am having the same problem.  Somehow the auto export, "exportfs -a" is getting a set of default options that includes RO, and the per-host config is not overriding it.

 

I did find a fix(hack) that will force all mounts to RW.

I wrote a script to edit /etc/exports to force RW (and for me "no_root_squash")

It should be safe, but if the format of the exports file changes at all it will stop working and need to be updated as it looks for what is currently in the options of the exports files and adds "rw,no_root_squash" only if it finds the same beginning of the options line as now exists.

 

#!/bin/sh

OPTIONS_TO_ADD="rw,no_root_squash"

touch /etc/exports2 

while true
do
diff /etc/exports /etc/exports2
if [ $? -ne 0 ]; then
	echo "Updating /etc/exports with $OPTIONS_TO_ADD"
	cp /etc/exports /etc/exports.bak
	sed "s/ -async/ -$OPTIONS_TO_ADD,async/" /etc/exports.bak > /etc/exports2
	cp /etc/exports2 /etc/exports

	exportfs -a 
fi
sleep 60
done

 

 

In /boot/config/go I call the script

# reexport NFS RW under Private
/boot/config/make_nfs_rw.sh &

 

NOTES:

- The ampersand is important as the script does not exit.

- Once this bug is fixed, remove the script from /boot/config/go

- You cannot override what my script does with a "ro" in a host, so if you need mixed ro and rw exports the script needs to be updated.

- Also, it only runs at boot, so if you change a config from the web interface it will blow away the changes.  You can re-run the script though.

 

This seems like it might be a bug in nfsd itself, not allowing a per-host configuration to override the default configuration.

 

For the problem to troubleshoot the root cause:

 

I have this set in the web configuration: 192.168.1.0/24(rw,no_root_squash)

I have these options for my exports from /exportfs: -async,no_subtree_check,fsid=102 192.168.1.0/24(rw,no_root_squash)

I see that it is actually exported with, from exportfs -v: 192.168.1.0/24((ro,async,wdelay,root_squash,no_subtree_check,fsid=108,sec=sys,ro,root_squash,no_all_squash)

 

If I do a manual export of a file system "exportfs -o async,no_subtree_check,fsid=12,rw,no_root_squash 192.168.1.0/24:/mnt/disk3" then that filesystem IS exported read write

exportfs -v gives these options 192.168.1.0/24(rw,async,wdelay,no_root_squash,no_subtree_check,fsid=12,sec=sys,rw,no_root_squash,no_all_squash)

 

so for some reason exportfs's default ro option is not being overridden by per host configuration.  Or the format changed and we need to change our configurations.

 

 

 

Link to comment

Thank you Ken-ji. 

I had read about sec=sys in the release notes of one of the unRAID 6 betas, but I thought that had been fixed within the unRAID configuration.

 

So, the better way to fix the NFS read only problem is to add "sec=sys" within the parenthesis of each of your NFS export rules.

 

This will apply the settings within your rule correctly it seems.  If you have more that one statement in your rule, for example

server1(rw, root_squash) server2(rw, no_root_squash)

you need add the sec=sys inside each section

server1(sec=sys,rw, root_squash) server2(sec=sys,rw, no_root_squash)

 

So thank you Ken-ji.  I hope this can go into the unRAID FAQ.

Link to comment
  • 7 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.