You are not logged in.
Hello, please let me know if I should change the thread title.
so I'm sharing a folder through NFS between two arch-linux pc's.
Host1 is my desktop, Host2 is my laptop.
I boot up my computer, rpcbind is started on boot-up
I launch the server on Host2
I launch the client on Host1
on Host2, I do a bind-mount from some directory to the one I'm exporting
I then unmount it, and it unmounts w/o error
then I redo the bind-mount
then, on the client, I mount the server's NFS share to some directory
then, on the client, I unmount it w/o error
then, on the server, I try to unmount the bind-mounted directory, but it won't, says it's "busy"
if I restart the server, then I can unmount the bind-mount w/o error, but I believe it should work without me having to restart the server every time
I want to bind a different directory to the exported directory.
server
$ systemctl start nfs-server
client
$ systemctl start nfs-client.target
server
$ mount test/ nfs/ --bind
client
$ mount Host1:/srv/nfs /mnt/nfs -t nfs
$ umount /mnt/nfs
server
$ umount /srv/nfs
umount: /srv/nfs: target is busy
(In some cases useful info about processes that
use the device is found by lsof(8) or fuser(1).)
the output of
$ lsof | grep /srv/nfs
$ lsof | grep /srv
did not show anything that had either the substring "nfs" or "rpc" in it...
below is the status of both hosts rpcbind @startup (they were identical)
$ systemctl status rpcbind
rpcbind.service - RPC bind service
Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; static)
Active: active (running) since Sat 2014-12-06 15:51:38 PST; 46s ago
Process: 262 ExecStart=/usr/bin/rpcbind -w ${RPCBIND_ARGS} (code=exited, status=0/SUCCESS)
Main PID: 264 (rpcbind)
CGroup: /system.slice/rpcbind.service
└─264 /usr/bin/rpcbind -w
Dec 06 15:51:38 BabaLinux systemd[1]: Started RPC bind service.
below is the status of the nfs-server @ startup then after it was launched
$ systemctl status nfs-server
nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
Active: inactive (dead)
$ systemctl status nfs-server
nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
Active: active (exited) since Sat 2014-12-06 15:53:44 PST; 21s ago
Process: 483 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 480 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 483 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/nfs-server.service
Dec 06 15:53:44 BabaLinux exportfs[480]: exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "NeoZelux:/srv/nfs".
Dec 06 15:53:44 BabaLinux exportfs[480]: Assuming default behaviour ('no_subtree_check').
Dec 06 15:53:44 BabaLinux exportfs[480]: NOTE: this default has changed since nfs-utils version 1.0.x
Dec 06 15:53:44 BabaLinux systemd[1]: Started NFS server and services.
below is the status of the nfs-client @ startup then after it was launched
$ systemctl status nfs-client.target
nfs-client.target - NFS client services
Loaded: loaded (/usr/lib/systemd/system/nfs-client.target; disabled)
Active: inactive (dead)
$ systemctl status nfs-client.target
nfs-client.target - NFS client services
Loaded: loaded (/usr/lib/systemd/system/nfs-client.target; disabled)
Active: active since Sat 2014-12-06 15:54:18 PST; 4s ago
Dec 06 15:54:18 NeoZelux systemd[1]: Starting NFS client services.
Dec 06 15:54:18 NeoZelux systemd[1]: Reached target NFS client services.
Offline
It's not unreasonable that your nfs-server keeps a lock on the directory you decided to share. I also fail to see why you are mount-binding so many times, could you explain the reason behind this? Maybe you're better of with a symlink to the nfs share instead of mounting it multiple times
Offline
NFSv4 operates in "namespaces" and you're basically messing with it's brain by bind-mounting (and unmounting) within the exported directory while it's live, without using the exportfs command (either via add/remove in /etc/exports or just putting it all on the commandline). You'll want to read up on section 7 of the RFC:
https://tools.ietf.org/html/rfc5661
In essence you're confusing it's brain -- when you add a bind mount, re-export and vice versa -- when removing it, deconfigure and re-export. It still might not work but you can try -- like Spider.007 I question your technique and methodology. It just feels like you're trying to do something... "wrong" here that should be designed in a better way.
Offline
so sorry for the super late reply, christmas shopping...
anyway sorry if it was confusing to show the double bind mount, I was trying to demonstrate that unmounting only fails after I start the client.
So are you trying to say that it's normal behaviour to be unable to unmount a directory while it was being shared ? I had thought that it would be bad practice
to terminate the server while the directory was still bound to another one, but it sounds like you're saying it's the other way around.
So what is the most elegant/convenient, least convoluted way to share a different directory w/ the client after I'm done doing stuff with the other directory ?
Offline