You are not logged in.
With a server whose exports looks like:
/srv/nfs4 192.168.122.0/24(rw,no_subtree_check,nohide)And with a directory hierarchy:
/srv/nfs4/code/proj1
/srv/nfs4/code/proj2
/srv/nfs4/code/proj3
/srv/nfs4/code/proj4Is it possible to mount an arbitrary descendant of /srv/nfs4 on a client? For example:
mount -t nfs4 host:/srv/nfs4/code/proj1If I try the above, it fails. The only way I can get it working is if I mount the exact directory that is exported on the server. Is that expected behavior? I assumed that if the host mounted a directory, that a client could mount an arbitrary descendant of that directory. Is that false?
Thanks,
Brandon
Last edited by brandonw (2013-03-31 12:12:18)
Offline
Judging by tab completion, I would say that it has to be the specified directory that is exported.
I have noticed though that this is totally possible with cifs. For instance, if you have it set to have your $HOME as a share, you could do
# mount -t cifs -o user=dirty,password=old,workgroup=MAN //192.168.0.2/homes/downloads/superporn /mnt What's more, is that if you have a symlink that leads to a part of the directory tree that is closer to /, it will allow that. So in other words, it does not employ a strict chroot like nfs or sftp.
Offline
I am able to do this with NFS4, the main difference between your exports and mine is the fsid=0 option (used to be in the wiki but not anymore for some reason). IIRC this option is necessary to mount shares like this.
Offline
I am able to do this with NFS4, the main difference between your exports and mine is the fsid=0 option (used to be in the wiki but not anymore for some reason). IIRC this option is necessary to mount shares like this.
Thanks! I did read a few mentions of fsid=0 in my googling, but I didn't think it was applicable to my situation. That was probably me misunderstanding how NFS works. I'll try this out when I get home and let you know if it works.
Offline
It does not seem to work for me. I still need to specify each individual descendant in the exports file in order for me to mount that directory directly on the client. I think fsid=0 is used by default on the first share in /etc/exports, but I'm not sure.
Offline
I've tried the same options in exports as you've posted and this doesn't seem to work. The export options which work for me are:
/mnt 192.168.1.0/24(rw,fsid=0,async,no_subtree_check,insecure,all_squash)I've tried adding the nohide option to these as well and it seems to cause some strange issues.
Last edited by neilzium (2013-03-28 17:41:02)
Offline
Tried that exact option. It still doesn't work.
Could there be something else unrelated to /etc/exports that could be causing me problems, I wonder? Perhaps ownership, or permissions issues?
Offline
It may help if you post more info including /etc/conf.d/nfs-server /etc/conf.d/nfs-common /etc/idmapd.conf.
If you're mapping your clients to the nobody user, they may need appropriate permissions to the nfs folder structure such as execute on directories
Also make sure you have rpcbind, mountd and idmapd running as well.
Last edited by neilzium (2013-03-29 16:23:05)
Offline
/etc/conf.d/nfs-server.conf
# Parameters to be passed to nfs-server init script.
#
# Options to pass to rpc.nfsd.
# See rpc.nfsd(8) for more details.
NFSD_OPTS=""
# Number of servers to start up; the default is 8 servers.
NFSD_COUNT=""
# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd".
PROCNFSD_MOUNTPOINT=""
# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid".
PROCNFSD_MOUNTOPTS=""
# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option.
# See rpc.mountd(8) for more details.
MOUNTD_OPTS=""
# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=""
# Options to pass to rpc.svcgssd.
# See rpc.svcgssd(8) for more details.
SVCGSSD_OPTS=""/etc/conf.d/nfs-common
# Parameters to be passed to nfs-common (nfs clients & server) init script.
#
# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=""
# Options to pass to rpc.statd.
# See rpc.statd(8) for more details.
# N.B. statd normally runs on both client and server, and run-time
# options should be specified accordingly.
# STATD_OPTS="-p 32765 -o 32766"
STATD_OPTS=""
# Options to pass to sm-notify
# e.g. SMNOTIFY_OPTS="-p 32764"
SMNOTIFY_OPTS=""
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=""
# Options to pass to rpc.idmapd.
# See rpc.idmapd(8) for more details.
IDMAPD_OPTS=""
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=""
# Options to pass to rpc.gssd.
# See rpc.gssd(8) for more details.
GSSD_OPTS=""
# Where to mount rpc_pipefs filesystem; the default is "/var/lib/nfs/rpc_pipefs".
PIPEFS_MOUNTPOINT=""
# Options used to mount rpc_pipefs filesystem; the default is "defaults".
PIPEFS_MOUNTOPTS=""/etc/conf.d/nfs
#
# Optinal options passed to rquotad
RPCRQUOTADOPTS=""
#
# Optional arguments passed to in-kernel lockd
#LOCKDARG=
# TCP port rpc.lockd should listen on.
#LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
#LOCKD_UDPPORT=32769
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
RPCNFSDARGS=""
# Number of nfs server processes to be started.
# The default is 8.
RPCNFSDCOUNT=8
# Set V4 grace period in seconds
#NFSD_V4_GRACE=90
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
RPCMOUNTDOPTS=""
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
STATDARG=""
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
RPCIDMAPDARGS=""
#
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
RPCGSSDARGS=""
#
# Optional arguments passed to rpc.svcgssd. See rpc.svcgssd(8)
RPCSVCGSSDARGS=""
#
# To enable RDMA support on the server by setting this to
# the port the server should listen on
#RDMA_PORT=20049
#
# Optional arguments passed to blkmapd. See blkmapd(8)
BLKMAPDARGS=""/etc/idmapd.conf
[General]
Verbosity = 1
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = blah
[Mapping]
Nobody-User = nobody
Nobody-Group = nobody
[Translation]
Method = nsswitchrpc-bind,mountd,idmapd are all running.
/srv/nfs is my root folder shared over nfs, and has drwxr-xr-x, as does /srv/nfs/code underneath it.
Interesting note that seems like it could be related: when I mount /srv/nfs4 from the client, it will see the code sub-directory, but not the sub-directories beneath that (one of which is the one I am trying to mount). All of those directories have the same permissions as /srv/nfs4 and /srv/nfs4/code.
Just for reference, this is the bind mount in fstab that I use to mirror my home directory:
/home/brandon/code /srv/nfs4/code none bind 0 0Being unable to see any of the project sub-directories on the client even if I mount from the root /srv/nfs4 seems like the most glaring issue that could perhaps be related to why I can't mount the sub-directory directly. Any ideas?
Thanks,
Brandon
Last edited by brandonw (2013-03-30 05:43:47)
Offline
Just for reference, this is the bind mount in fstab that I use to mirror my home directory:
If you'd mentioned that before I suspect this thread would be a lot shorter ![]()
NFS mounts do not follow mountpoints underneath it by default but I think there is a way to do this. Glancing at the exports manpage, the crossmnt option along with nohide may be what you're looking for.
Offline
That worked!
I remember reading that in the man pages, too, but I somehow had tunnel vision just copying exactly what the wiki described without thinking about the bind mount.
Thanks for all the help!
Offline
Could you mark the post as [SOLVED]?
Offline
Sorry about that. I looked for an explicit mechanism yesterday, and then forgot about it. I assume marking the post as SOLVED is just changing the topic of the original post?
Offline
That's correct
Offline