Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to define an alias for a NFS-exported directory directly inside /etc/exports (without using a symlink)?

For example, I want to access this export

/home/username/nfsdir 192.168.0.100(rw,sync,no_root_squash)

as `"hostname:/myalias" instead of "hostname:/home/username/nfsdir".

share|improve this question
up vote 1 down vote accepted

You could use mount -t bind to create the "alias". ie

mount -t bind /home/username/nfsdir /myalias

and then export /myalias.

To make this permanent, add the following line to your /etc/fstab

/home/username/nfsdir /myalias bind bind 0 0
share|improve this answer
1  
Right, but that is the same as creating a symlink. I'm searching for a way to do this using the /etc/exports file only. Something like the share names in Windows/Samba, which are mapped to real paths. – AndiDog Feb 8 '10 at 11:56
    
Which OS is your nfs server running? It appears that some nfs servers support a "refer" option which may do what you want. See "man exports" on your nfs server to see if it supports "refer". – Convict Feb 8 '10 at 12:45
    
It's a minimal Debian lenny. Thanks for the suggestion, I'll try that asap. – AndiDog Feb 8 '10 at 13:13
    
Tried /myalias 192.168.139.0/24(rw,sync,no_root_squash,refer=/real/directory@192.168.39.129) (.129 being the NFS server itself) with no success. It keeps showing me the empty directory /myalias instead of "forwarding" me to the files in /real/path. Can you give me a working example config? (note: I tried it with and without mount --bind /real/directory /real/directory as described in the man page) – AndiDog Feb 8 '10 at 15:22
    
Sorry, I haven't used the refer option before. :-( I saw it there and thought it might be useful to you. – Convict Feb 9 '10 at 1:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .