SMB Symlinks

Discussion in 'macOS' started by coughplease, Mar 7, 2010.

  1. coughplease macrumors newbie

    Mar 7, 2010

    Hope someone can help me with this, its fairly obscure.

    I am trying to get a media player to work (Popcorn Hour A-110) and have run into a problem with it only able to mount one smb share at one time.

    I currently have movies stored on two external hard drives connected to the media player as well as movies on an internal hard drive inside the media player.

    I have been advised that a symlink would solve this situation but have no idea how to do this correctly!

    Can anyone talk me through, and advice me if i need to post any more information. I have tried the media players forum but to no avail.

    Thanks in advance.

  2. r0k macrumors 68040


    Mar 3, 2008
    Welcome to MacRumors, coughplease!

    When you have a network or usb disk mounted or even a disk image, it shows up in /volumes. You can create a sym link in another folder like this:

    In terminal type the following:
    ln -s /Volumes/Smbshare1 mystuff1
    ln -s /Volumes/Smbshare2 mystuff2

    Where Smbshare1 and Smbshare2 are the names of the smb shares you are trying to mount. Make sure what you type in the sym links exactly matches what shows up in /volumes including upper case characters.

    Now it appears to your software that the files are coming from your home folder in two subfolders called mystuff1 and mystuff2. (cd without an argument changes to your home folder)

    The sym links will stay there even when the shares aren't properly mounted so make sure you can browse to the files you want in finder before launching your software. The sym links are not automatic. If the name of the mounted volume changes, you will need to delete the old sym link and create a new one.

    Sym links are one of my favorite things about Unix. They allow you to make it appear as if there are multiple copies of a file when in reality there is only one. Applications are presented with the file as if it was really in that location so they are always guaranteed to be "happy" with a sym link just as if it was a copy of the file itself. If you delete the source file sym links are pointing to, the links remain. On Linux they turn red but on OS X, you might not see any indication that the underlying file is no longer present. I'm not in front of my Mac right now so I can't tell.

    This is a subtle capability that illustrates just how much M$ fails to "get it". Their answer to sym links is shortcuts. Shortcuts can only be handled by a handful of programs and results are never consistent. Sym links are handled by the OS at a low level and they always always always work as expected.

    I should point out that doing things in terminal can be risky. If you happen to delete something important, OS X isn't going to ask "are you sure?" so proceed carefully. Most really dangerous things require sudo, but you can still mess things up pretty badly by not paying attention. For instance, suppose you decide to dump all your smb sym links and you decide to type
    rm Sm*
    but you forget you have your tax returns in a file called, they will be gone as well! So take your time and be careful and you might find sym links to be one of the most useful things about Unix in general and OS X in particular.

Share This Page