Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am exporting my /opt/target directory via NFS but I would like the nfs clients to be able to mount it as /target. i.e. I would like showmount -e to show /target not /opt/target. Can that be done?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

I'm pretty sure NFS does not allow for aliases. Symlinking is probably best, and it'll save you from moving the export as a whole to an illogical location (/target).

The original suggestion here was to symlink /opt/target to /target and then export /target. NFS supports this and I don't know of any good reasons not to use symlinks this way.

share|improve this answer
    
I have done this and it works well as long as you remember that symlinks in the exported directory will not be translated. If you've got a relative link to ../../../bar and your NFS mount is a symlink to /foo, then anything looking at /foo/bar will actually try to look in /foo/../../../bar –  Matt Simmons Jun 17 '09 at 14:54
    
I looked far and wide for 'aliasing' but did not find anything for NFS. I also originally entered an answer which suggested symlinking, however when I did showmount -e it showed the original directory anyway, so symlinking does not appear to work as an 'alias' either. –  Dave Drager Jun 17 '09 at 14:57

What you want is how NFSv4 works. In NFSv4, all the directories exported are from a single pseudo-filesystem where the real directories are mounted with --bind. See the Ubuntu NFSv4 Howto for an example.

share|improve this answer

You would need to change the path on the server. I'm not sure if you can export via a symlink, otherwise you'd need to move the path physically on the server. Looking at the man page for exports, you might be able to use the "refer" option.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.