Score:1

mount nfs as another folder on home

vn flag

I have purchased a WD-Ex2 NAS and am trying to share a folder via nfs with my ubuntu machine.

This folder will be used only by this machine and I want to be able to have execute permissions with my user. I would like it to be treated as one more home folder.

I am mounting the folder as follows

$ sudo cat /etc/fstab
...
#nfs mycloud
192.168.0.151:/nfs/tmp_msigs60 /media/tmp_msigs60  nfs     defaults,user,relatime,rw,exec    0       0

but I don't have execute permissions and the owner is user # 501 not my user

I have tried mounting with the following options

192.168.0.151:/nfs/tmp_msigs60 /media/tmp_msigs60  nfs     defaults,user,relatime,rw,exec,uid=1000,gid=1000,umask=002    0       0

but when putting uid=1000,gid=1000,umask=002 I get the error:

mount.nfs: an incorrect mount option was specified

Another thing I have tried is to edit /etc/idmapd.conf and change nobody and nogroup for my user, but I have not had any result either

[General]

Verbosity = 0
Pipefs-Directory = /run/rpc_pipefs


[Mapping]
Nobody-User = rodrigo
Nobody-Group = rodrigo

Another thing that I have noticed is that the speed of writing and reading starts with high speed, but it decreases considerably while transferring the file in that folder. I do not know what are the recommended parameters to mount it efficiently, I have seen that sometimes buffer sizes are used as parameters

Edit 1 Thanks to @MichaelHampton I have discovered that the file /etc/exports of the server contain the following:

"/nfs/tmp_msigs60" 192.168.0.121(rw,all_squash,sync,no_wdelay,insecure_locks,insecure,no_subtree_check,anonuid=501,anongid=1000)

Edit 2 according to WD support, the nfs they provide do not support asynchronous operations. It does not matter what configuration is put in /etc/exports

Michael Hampton avatar
cz flag
What is the filesystem type of the remote filesystem?
vn flag
ext4. It caught my attention when I formatted the disks that the NAS didn't let me choose, but a message showed ext4
Michael Hampton avatar
cz flag
Don't use the `user` option then. Or any of those other user related ones. You'll set ownership and permissions on your files normally once it's mounted.
vn flag
I also tried using `defaults` or `rw,exec` as mounting options but behaves in same way
Michael Hampton avatar
cz flag
What do you mean by "same way"?
vn flag
no execution permissions and the user `user #501` as owner
Michael Hampton avatar
cz flag
Again, change the ownership and permissions to what you want.
vn flag
maybe there is something more basic that I need to understand. If I run `sudo chown -R $ USER /media/tmp_msigs60/blabla` I get an operation not allowed error because I am not an owner
Michael Hampton avatar
cz flag
Does that include the typo? Anyway at this point you probably have inappropriate export options. Check the NFS server.
vn flag
sorry the space in `$ USER` was the translator. I honestly wouldn't know what to check on the server. The MYCLOUD web interface does not offer any option, only the check to enable nfs and restrict access by ip. But I can connect by ssh to nas. But what do I check?
vn flag
@MichaelHampton I have updated the question with the content of the /etc/exports file on the server
Score:1
cz flag

Your problem here is all_squash, which really doesn't make sense in this context. If all your clients were Windows then it might be useful, as Windows has no real concept of Unix permissions. You should remove that option, along with its related options anonuid and anongid. Replace these with no_root_squash which will allow your Linux client full access to the share. And be sure to figure out, if you can, why the NAS has put these options there and stop it from doing so if possible.

vn flag
thanks!!! this has solved the permissions issue. But it still has a strange behavior, it only performs one operation per time, for example I copy a file, until it finishes copying I cannot perform another operation, not even an ls in console. I am mounting the filesystem only passing defaults as an option, on the other hand the writing speeds are not the expected 20mb / s
Michael Hampton avatar
cz flag
That's not very good performance. I like this NAS less and less the more I hear about it. Do you need to keep the `sync` export option or can you change that to `async`? (Check the exports(5) man page to understand the difference.)
vn flag
With the following option `defaults,rsize=32768,wsize=32768,async` get the transfer time to start around 200mb / s but decrease constantly until it reaches 16mb / s. The strange thing is that default includes async but if the option is not added explicitly and at the end of the command it does not seem to work. thank you very much, I will continue investigating this
Michael Hampton avatar
cz flag
@user60108 What do you mean? `sync` is very explicitly specified in the `exports` on the NAS and again, that's what you need to change.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.