Mount NFS share with a space in the name?

Discussion in 'Other Operating Systems' started by Dave, Jul 25, 2020.

  1. Dave

    Dave Member

    Joined:
    Jun 26, 2001
    Messages:
    339
    Location:
    Morayfield (4506)
    I'm trying to mount an NFS share with a space in the name.

    $ showmount -e 192.168.0.2

    Export list for 192.168.0.2:
    /mnt/user/Movies *
    /mnt/user/Music *
    /mnt/user/TV Shows *

    sudo mount -t nfs 192.168.0.2:/mnt/user/Movies /mnt/unraid/Movies
    sudo mount -t nfs 192.168.0.2:/mnt/user/Music /mnt/unraid/Music

    Both work fine, but I keep getting an error when mounting the TV Shows share, google has given me these suggestions, but they all fail.

    sudo mount -t nfs 192.168.0.2:/mnt/user/TV Shows /mnt/unraid/TV_Shows
    mount: bad usage

    sudo mount -t nfs 192.168.0.2:/mnt/user/TV\040Shows /mnt/unraid/TV_Shows
    mount.nfs: Protocol not supported

    sudo mount -t nfs 192.168.0.2:/mnt/user/TV%20Shows /mnt/unraid/TV_Shows
    mount.nfs: Protocol not supported

    sudo mount -t nfs 192.168.0.2:/mnt/user/"TV Shows" /mnt/unraid/TV_Shows
    mount.nfs: Protocol not supported

    sudo mount -t nfs 192.168.0.2:"/mnt/user/TV Shows" /mnt/unraid/TV_Shows
    mount.nfs: Protocol not supported

    sudo mount -t nfs "192.168.0.2:/mnt/user/TV Shows" /mnt/unraid/TV_Shows
    mount.nfs: Protocol not supported

    Any help would be appreciated.
     
  2. Renza

    Renza Member

    Joined:
    Dec 1, 2004
    Messages:
    4,851
    Location:
    Melbourne
    I think you need to escape the space. putting %20 is url encoding, so won't work in this case.

    give this a shot

    Code:
    sudo mount -t nfs 192.168.0.2:/mnt/user/TV\ Shows /mnt/unraid/TV_Shows
    putting a `\` before a space tells the shell not to interpret it as a separate argument being passed in, but as a continuation of the string.
     
    mooboyj likes this.
  3. OP
    OP
    Dave

    Dave Member

    Joined:
    Jun 26, 2001
    Messages:
    339
    Location:
    Morayfield (4506)
    Thanks Renza, that worked. :)
     
    Renza likes this.
  4. GumbyNoTalent

    GumbyNoTalent Member

    Joined:
    Jan 8, 2003
    Messages:
    9,707
    Location:
    Briz Vegas
    elvis likes this.
  5. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    I think it's best to understand this within the context of the shell command evaluation process. In particular, field or word splitting is the explicit function which uses spaces to separate arguments.

    Escape characters are one way to get around this. Quoting is another. These lines are equivalent when evaluated in BASH.
    Code:
    sudo mount -t nfs nfstarget:/media/officefs/test\ dir
    Code:
    sudo mount -t nfs "nfstarget:/media/officefs/test dir"
    Code:
    sudo mount -t nfs 'nfstarget:/media/officefs/test dir'
    There would be differences between quoting methods in command strings which use globs, variable expansion, and so forth, but in this more limited case, they work the same.
     
    MrSnuffy likes this.
  6. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane
    On a side note, when I run teams of Linux/UNIX/storage folk, I make it strict policy to not allow upper case, special characters or spaces in root-share file/folder names.

    I get the usual whining and "arrogant Linux control freak" type comments, but I also have zero problems with anyone using storage from any system in the business.

    Once you're below the root share, do whatever insane thing you like. But the share folder name and definition itself, keep it simple stupid.
     
    Fred Nurk, Renza and Quadbox like this.
  7. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    Underscores okay? :)
     
  8. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane
    Again, I tend to recommend they be avoided for root shares.

    People's OCD around the need for a root share to be half a novel isn't really my problem. My problem is ensuring big expensive storage works for every big expensive computer in the big expensive business.

    There are deeper philosophical discussions people are welcome to about how much data and metadata you want to bake into a share name. For me, as long as its short and unique, the rest comes down to training. Once you're past that share, again, put in all the insanity you want.

    And with all that said - if people can deal with drive letters as a single letter, they can deal with root level shares without punctuation or special characters.

    This somewhat falls in the realm of "bikesheds" (aka: "Law of Triviality"). The people rolling out the big expensive storage tell you how to use it. If your one contribution is that you really, really want spaces and underscores because it feels nice, then expect that input to be ignored in the bigger picture of making the computers work properly.

    https://en.wikipedia.org/wiki/Law_of_triviality

    As the example goes, it's often easier to get approval for nuclear power stations than it is for bike sheds, because everyone wants to have input on a bike shed contrary to expert advice, but nobody's brave enough to have input on a nuclear power station contrary to expert advice.
     
    Last edited: Jul 30, 2020
    MrSnuffy likes this.
  9. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    I do agree. I'm not one to favour exotic directory constructs for my CIFS and NFS shares. I was wondering which particular issues you've found and which of the less, um, tolerant operating systems you've had issues with.

    The original question also serves as a practical example of how part of the shell evaluation pipeline works and that's valuable by itself regardless of quirks network filesystem implementations in the wild might have.
     
    Last edited: Jul 30, 2020
  10. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane
    Over the years, many. There'll always be some stupid vendor product that can't map a given character because their developer couldn't read an RFC (like devs who reject "+" symbols used in email delimiters, despite them being valid characters).

    But it's fun things like macOS replacing a standard "." period with some weird unicode variant, or putting bullet points in to file names, etc, that really screw things up.

    Likewise certain Windows tools will do the same - replace standard character sets with unicode variants. Usually due to some numpty saving vital file path data in a word doc or excel sheet and then copy/pasting with formatting and autocorrection and all other "handy" tools forced upon us that destroy the sanctity of plain ASCII text.

    I've also worked for places that frequently got in double-byte fonts (non-English scripts and other language characters), as well as emojis of course (because we need those in file names, right?).

    It got so bad at one place I worked that we had to develop a web based tool that users wanting to start projects would use to initialise things. Wasn't much more than simple filter that extracted [a-z,0-9] and trimmed all other characters. But it was worth the development time simply to save downstream headaches.

    I-unicode.jpg
     
    GumbyNoTalent likes this.
  11. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    Oh, sweet Jesus!
     
  12. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane
    Checking out a client's Time Machine / Time Capsule server I built....

    Code:
    root@timemachine:/raid/timemachine# ls -lah
    
    drwx--S--- 1 timemachine timemachine 376 Aug 11 11:23 'Scottâs MacBook Pro.backupbundle'
    
    I can 100% guarantee you that "â" symbol is not what the machine hostname actually is. Yup, thanks macOS.
     
  13. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    Interesting question: does the MacOS terminal suffer from the same character encoding flaws? In other words, is MacOS just too dumb to play with others or is it too dumb to play with itself?
     
  14. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane
    In my experience over the decades, it's inconsistent. Some of the BSD tools in Mac will display things in pure POSIX, converted to weird symbols like the above. Newer tools that sit up in the Cocoa and above layers often interpret them fine. (Remembering that macOS is *still* at heart two different operating systems sharing a kernel. If in doubt, see how Finder/GUI and shell/CLI tools interpret file systems differently - CLI tools can use NFS shares fine, GUI tools lock up the whole OS. And the simple reason is that they use different parts of the OS to get to the storage/VFS layer (no other OS does this).

    If really want to party, try newer apps that allow emojis in filenames (yes, really).

    Honestly, the whole thing is a farce, and is further proof that macOS doesn't belong in business rollouts. They're Facebook browsing machines for your Grandma only.
     
  15. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    That's a world class level of design incompetence. They've built two different primary libraries for their VFS interface. Unbelievable.
     
    elvis likes this.
  16. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane
    Sounds fairly obvious that it's utterly stupid, right?

    You'd get full agreement from anyone in this subforum. And the enterprise computing folks would agree easily, because they could forsee three damage it would do.

    But if you want to see a whole new level of Stockholm Syndrome, go post that in the Mac forums, and watch people tell you it's not Apple who are wrong, but *you* who are wrong for not understanding their genius and obviously using computers incorrectly.

    It's equal parts fascinating and worrying how rapidly people will cast aside common sense for brand worship.
     
  17. gdjacobs

    gdjacobs Member

    Joined:
    Apr 3, 2007
    Messages:
    2,637
    Location:
    MB, Canada
    Well, Steve certainly understood having a cult was the best way of separating people from their money.
     
  18. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    43,808
    Location:
    Brisbane

Share This Page

Advertisement: