How to set up symbolic link folder in NFS share from Samba share on NSA325?

hoverdonkey
hoverdonkey Posts: 11  Freshman Member
First Anniversary
Hi

First, my goal:  to access media files on my NSA325 through NFS.  Rather than moving my content from my existing Samba shares on NSA325 (video, photo & music) I would like to create symbolic link folders in an NFS share leading to these.

I set up an NFS share called Media (using Network\NFS\Add NFS Share in the NSA325 GUI), under which I would like the symlink folders for video, photo & music.

Next, I SSH'd into the NSA325 and entered (taking the video share as an example):

ln -s /i-data/c92fee57/video /i-data/c92fee57/nfs/Media

This sets up a symlink folder called video as expected which I can access in SSH and put files in... so good so far.  However, whilst I can see the new symlink folder in both the NSA325 share browser and Windows File Explorer, I cannot open it in either (NSA325 says "Access denied.", Windows says "Windows cannot access [path]...").  I tried setting up the links in SSH as both root and admin, but that made no difference.

I would be grateful for any tips please - as you might be able to tell I'm am a bit of a toddler in SSH in this land.



NSA325 Firmware version : NSA325_4.81(AAAJ.1)

Accepted Solution

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    The file /etc/exports is the database of nfs exported directories. So you can use that to export /i-data/c92fee57/video directly.
    Google on 'man /etc/exports'.

All Replies

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    That ain't gonna work. A symlink is basically a textfile containing a path. The filesystem layer recognizes it as a link, and does the redirection.
    So now you created a symlink containing '/i-data/c92fee57/video', and that symlink is shared over NFS. The client doesn't know about '/i-data/c92fee57', and can't follow that link anyway, as it points outside the shared path.
    The other way around might work, samba doesn't share a filesystem, but shares files. So the interpretation of a symlink for samba is done serverside. Yet I don't know if following symlinks is enabled in the firmware samba.

    You could use a bindmount. When Media is a directory, and not a symlink, you can mount another directory on it:

    mount --bind /i-data/c92fee57/video /i-data/c92fee57/nfs/Media

    You'll have to repeat that after each reboot.

    The most simple solution is to edit /etc/exports, and create your own nfs exports. Be careful, /etc/exports is a symlink to another file in a non-volatile filesystem, so if you accidentally overwrite the symlink instead of the file it points to, the change won't survive a reboot.






  • hoverdonkey
    hoverdonkey Posts: 11  Freshman Member
    First Anniversary
    Many thanks @Mijzelf for your full and clear response, it is much appreciated. Why it didn't work now makes perfect sense to me. I think, however, I have misunderstood your suggested solution, as what I tried doesn't work. 

    The first step is fine:  i.e. pasting 'mount --bind /i-data/c92fee57/JunkMedia /i-data/c92fee57/nfs/Media' in SSH works perfectly (nfs/Media is populated as expected and then empties after reboot, as you suggested it would).

    I then tried adding the line to exports. My '/etc/exports' links to '/usr/local/zy-pkgs/etc/exports' so I edited that.  Originally it just had the one line:

    /i-data/c92fee57/nfs/Media *(rw,sync,no_subtree_check,wdelay,no_root_squash) #


    After my edit it has two lines, thus:

    /i-data/c92fee57/nfs/Media *(rw,sync,no_subtree_check,wdelay,no_root_squash) #
    mount --bind /i-data/c92fee57/video /i-data/c92fee57/nfs/Media #


    The changes to exports are still there after reboot, however nfs/Media remains empty.  I tried with and without the final '#'.


    I would be very grateful for another nudge in the right direction, I feel I am very close!
  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    Answer ✓
    The file /etc/exports is the database of nfs exported directories. So you can use that to export /i-data/c92fee57/video directly.
    Google on 'man /etc/exports'.
  • hoverdonkey
    hoverdonkey Posts: 11  Freshman Member
    First Anniversary
    Brilliant, thanks @Mijzelf, perfect!  I never for a minute thought it would be that simple.

    It's great that this helped you too, @katesmith1304



Consumer Product Help Center