Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm in a bit of a pinch with NFS exports file.

Specifically, I can't find a way to export a directory containing "-" in the path name.

Manual (exports(5)) states:

Also, each line may have one or more specifications for default options 
after the path name, in the form of a dash ("-") followed by an option 
list. The option list is used for all subsequent exports on that line 
only.

It then states:

If an export name contains spaces it should be quoted using double quotes. 
You can also specify spaces or other unusual character in the export name 
using a backslash followed by the character code as three octal digits.

Unfortunately, that is not the case. Specifically, if the pathname contains "-", either verbatim, or with \055 or is enclosed in double quotes, it still refers to the name without "-"

Any ideas? I have a large number of directories, all of the form

  • /vol/buildsystem-s3c2440
  • /vol/buildsystem-tao3530

and I'd prefer to have them all available as nfs exports. Short of replacing the "-" with "_" everywhere in the scripts, can it be done with "-" ?

share|improve this question
    
I don't have a solid answer, but this did pop into my head: Do you have some sort of nfs manager available (probably some cheesy X app) that would generate the exports file for you? Maybe try it on test machine just to check the syntax and then implement on the box in question. Just a thought... –  英律功 Dec 13 '10 at 12:09
    
I don't know of any such utils... –  qdot Dec 13 '10 at 14:19
1  
What version of nfs-utils do you have ? –  Kjetil Jørgensen Dec 14 '10 at 14:43
    
Works for me under Debian lenny (NFS utils 1.1.2, kernel 2.6.26) with /var/tmp/foo-bar localhost(all_squash,async,no_subtree_check) in /etc/exports. –  Gilles Dec 16 '10 at 21:47
    
What system are you on? My guess is that you can backslash escape it using the Linux nfs-kernel-server, but not the Linux nfs-user-server. –  Mikel Feb 13 '11 at 5:45

5 Answers 5

up vote 2 down vote accepted

Based on this text, I assume you are on Linux?

If an export name contains spaces it should be quoted using double quotes. You can also specify spaces or other unusual character in the export name using a backslash followed by the character code as three octal digits.

There are two different NFS server implementations on Linux systems:

  • user NFS
  • kernel NFS

Please try running ps -ef | grep nfsd to see which one you have.

I think user NFS will appear as nfsd or unfsd, and kernel NFS will appear as [nfsd].
(Note how one has square brackets, but the other does not.)

With kernel NFS you should use double quotes or octal escapes, e.g.

"/path/to/mount-point" <options>

or

/path/to/mount\055point <options>

(Reference: nfs-utils-1.1.2, xgettok in support/nfs/xio.c)

With user NFS, spaces are not allowed in export names, but a minus sign (-) should not require escaping, e.g.

/path/to/mount-point <options>

(Reference: nfs-user-server-2.2beta47, filt_getc in auth_init.c)

If you can't get to the bottom of it, I would suggest switching from user NFS to kernel NFS so that you can use quoting or octal escapes.

On Debian and Ubuntu:

  • apt-get install kernel-nfs-server

On Red Hat and Fedora:

  • yum install nfs-utils
share|improve this answer

Have you tried simply escaping with \-. I am not an NFS expert - but its worth a try. It works in many other situations...

share|improve this answer
    
Yes, I tried that. No, this doesn't work. –  qdot Dec 13 '10 at 14:20
    
Here - a graphical NFS tool to consider: dailypackage.fedorabook.com/index.php?/archives/… –  Danny Staple Dec 13 '10 at 15:24

Does escaping with backslash work?

  • /vol/buildsystem\-s3c2440
  • /vol/buildsystem\-tao3530
share|improve this answer
    
Yes, I tried that. No, this doesn't work :( –  qdot Dec 13 '10 at 14:21

Ok, maybe another workaround. It's a bit troublesome, but why not creating a directory containing symbolic links to all the previous directories (a script or a while loop could be used for this). If the names of the symbolic links do not contain any dash, you should be able to export them. This way, as you wished, you would not need to modify the names of your real directories.

I am not sure if it would work, but it's probably worth giving it a shot, isn't it?

share|improve this answer

This is a bit of a hack but you can create bind mounts to each of the directories and export the bind mounts destinations. Something like:

mount -o bind /vol/buildsystem-s3c2440 /vol/buildsystems3c2440
mount -o bind /vol/buildsystem-tao3530 /vol/buildsystemtao3530

I'm not sure if having tons of mounts will slow down file access though.

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.