This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to NFS share a mounted drive ?

Tags: None
(comma "," separated)
Alain2
Registered Member
Posts
6
Karma
0

How to NFS share a mounted drive ?

Wed Nov 28, 2012 3:43 pm
Hi,

I have recently re-installed a arch distro on my desktop with kde, and I have the following issue:

I tried to follow the guide https://wiki.archlinux.org/index.php/NFS to add shares on a desktop server I just installed (fresh Arch with systemd), and have now spent a few hours on a problem I don't see how to resolve, please can you help ? Below is a summary of the situation as I think is relevant:

On the server side, I have:
/etc/idmapd.conf:
Code: Select all
[General]

Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = test-domain

[Mapping]

Nobody-User = nobody
Nobody-Group = nobody

[Translation]

Method = nsswitch


/etc/exports:
Code: Select all
/srv/nfs4/ 192.168.3.25(rw,fsid=0,no_subtree_check)
/srv/nfs4/media 192.168.3.25(rw,no_subtree_check,nohide)


/etc/fstab:
Code: Select all
/media    /srv/nfs4/media   none    bind     0       0


Then on the client side I have
/etc/fstab:
Code: Select all
192.168.3.26:/media        /srv/nfs4-desktop/media    nfs4     noauto,rsize=8192,wsize=8192,timeo=14,intr 0 0



Now, in the server /media, I have added a few files and one directory manually, and I have an external drive (well an internal sata drive that I hot swap in a rack installed on the computer, so not usb but motherboard sata connector used) named Sata03 mounted via KDE in Dolphin. The permissions look like this on this server side:
Code: Select all
/media/:
total 144
drwxr-xr-x  4 root  root    4096 Nov 28 00:17 ./
drwxr-xr-x 21 root  root    4096 Jul 28 19:04 ../
drwxrwxrwx  6 alain users   4096 Nov 27 23:36 Sata03/
drwxr-xr-x  2 alain users   4096 Nov 28 00:03 test/
-rw-r--r--  1 alain users    618 Nov 27 23:35 exports
-rw-r--r--  1 alain users    547 Nov 27 23:53 fstab
-rw-r--r--  1 alain users    179 Nov 27 19:58 idmapd.conf
-rw-r--r--  1 alain users 118261 May 15  2012 tcp udp forwards.png

/media/test:
total 124
drwxr-xr-x 2 alain users   4096 Nov 28 00:03 ./
drwxr-xr-x 4 root  root    4096 Nov 28 00:17 ../
-rw-r--r-- 1 alain users 118261 May 15  2012 tcp udp forwards.png


And to confirm the bind is correct:
Code: Select all
/srv/nfs4/media/:
total 144
drwxr-xr-x 4 root  root    4096 Nov 28 00:17 ./
drwxr-xr-x 3 root  root    4096 Nov 27 20:01 ../
drwxrwxrwx 6 alain users   4096 Nov 27 23:36 Sata03/
drwxr-xr-x 2 alain users   4096 Nov 28 00:03 test/
-rw-r--r-- 1 alain users    618 Nov 27 23:35 exports
-rw-r--r-- 1 alain users    547 Nov 27 23:53 fstab
-rw-r--r-- 1 alain users    179 Nov 27 19:58 idmapd.conf
-rw-r--r-- 1 alain users 118261 May 15  2012 tcp udp forwards.png

/srv/nfs4/media/test:
total 124
drwxr-xr-x 2 alain users   4096 Nov 28 00:03 ./
drwxr-xr-x 4 root  root    4096 Nov 28 00:17 ../
-rw-r--r-- 1 alain users 118261 May 15  2012 tcp udp forwards.png


However on the client side, with the NFS share mounted, the owner, group and permissions changed on the mounted Sata03 folder, but not on the rest of the normal files and folders I placed on the server:
Code: Select all
/srv/nfs4-desktop/media/:
total 144
drwxr-xr-x 4 root  root   4096 Nov 28 00:44 ./
drwxr-xr-x 3 root  root    4096 Nov 28 00:25 ../
drwx------ 2 root  root    4096 Nov 27 23:55 Sata03/
drwxr-xr-x 2 alain users   4096 Nov 28 00:03 test/
-rw-r--r-- 1 alain users    618 Nov 27 23:35 exports
-rw-r--r-- 1 alain users    547 Nov 27 23:53 fstab
-rw-r--r-- 1 alain users    179 Nov 27 19:58 idmapd.conf
-rw-r--r-- 1 alain users 118261 May 15  2012 tcp udp forwards.png

/srv/nfs4-desktop/media/test/:
total 124
drwxr-xr-x 2 alain users   4096 Nov 28 00:03 ./
drwxr-xr-x 4 root  root   4096 Nov 28 00:44 ../
-rw-r--r-- 1 alain users 118261 May 15  2012 tcp udp forwards.png

Note that even as root on the client side I can't access the content of Sata03, even if I add the no_root_squash option on the server NFS exports..

Please can you help me to understand this and how to make Sata03 fully shared (777) on the client side ?



This seems related to the fact that Sata03 is mounted via kde, if I mount manually Sata03 (eg # mount -t ext4 /dev/disk/by-label/Sata03 /srv/nfs4/media/) then I get the correct owner/group/access rights on the client side...


Can someone help me to get this NFS working with mounted devices via kde, as it is certainly much easier for me to share whatever drive is mounted in /media via kde than to manually mount/umount the drives and corresponding NFS shares... ?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
On the server, can you please compare the mount options which are set by UDisks and you manually to see if they could be having an impact?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
Alain2
Registered Member
Posts
6
Karma
0
Thanks for the reply,

I gave up a bit on this and use sshfs instead which is working as expected, although I have low speed performances even with low-cpu cipher like arcfour256, hence I am still interested if I can get the NFS method to work (not bothered about security on my LAN)

To answer your question, I did look at the mounts and noticed one more argument in the mounts uhelper=udisks, however this is visible only with mount, it does not appear in mtab:
Code: Select all
# mount
[...]
/dev/sda1 on /media/Sata03 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
[...]
/dev/sdb3 on /mnt/nfs4/media type ext4 (rw,noatime,data=ordered)
/dev/sda1 on /mnt/nfs4/media/Sata03 type ext4 (rw,nosuid,nodev,relatime,data=ordered)

(here /dev/sbd3 is actually only /media on sdb3, this line corresponds to the mount bind)
Code: Select all
# cat /etc/mtab
[...]
/dev/sda1 /media/Sata03 ext4 rw,nosuid,nodev,relatime,data=ordered 0 0
[...]
/dev/sdb3 /mnt/nfs4/media ext4 rw,noatime,data=ordered 0 0
/dev/sda1 /mnt/nfs4/media/Sata03 ext4 rw,nosuid,nodev,relatime,data=ordered 0 0

Note that on the server side I tried to bind with both bind (as in arch tutorial) and rbind methods (to access submounts like Sata03 if I understand correctly man mount), but that doesn't make any difference; /mnt/nfs4/media/Sata03 is accessible without issues on the server side, but is not on the client side.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
I see /mnt/nfs4 and /srv/nfs4 being used - one in /etc/mtab and the other in /etc/exports.
Can you please clarify this?

Have you tried exporting the mounted drive as a seperately mounted media to see if that has any impact?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]