Announcement

Collapse
No announcement yet.

<SOLVED> Help needed with NFS exports and bind mounts

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    <SOLVED> Help needed with NFS exports and bind mounts

    I'm going batty trying to figure this out.

    I have a media server with four hard drives. There are 3 relevant partitions for this setup.

    Partition "A" contains 8 subdirectories of various sorts
    Partition "B" contains only movies and has 20 subdirectories
    Partition "C" contains videos other than movies in 7 subdirectories
    They all also contain some files in their root directory

    I wish to export all these partitions and their subdirectories with a single export I call "shared" and have all of the partitions subdirectories available. Since I access this data through numerous services (Roku, media computers, DLNA devices) the directory structure is critical. I don't want to combine all the partitions using formatting (raid, LVM or btrfs) for data backup and loss prevention reasons.

    SymLinking directories and then exporting is problematic so I want to use bind mounts for stability.

    Here's the question:

    The three partitions are mounted, then you bind the mounts and export them. The rub is the tree structure I desire:

    /shared --> All partition "A" files and subdirectories
    --> /Videos
    --> All partition "C" files and subdirectories
    --> /Movies
    -->All partition "B" files and subdirectories


    It's the nesting thats driving me batty. Can I even do this? I can't overlap mounts this way but there has to be a solution.

    Please Read Me

    #2
    Re: Help needed with NFS exports and bind mounts

    What about symlinking them on the client side instead of the server side? That way you wouldn't be symlinking across filesystems.

    Just a thought -
    we see things not as they are, but as we are.
    -- anais nin

    Comment


      #3
      Re: Help needed with NFS exports and bind mounts

      I'm very green on NFS filesharing, so forgive my noobish notion if it is too goofy.

      Could you structure your hierarchy on the server itself, under a /mnt/SHARED directory? For example:

      /mnt/SHARED <------ the exported directory

      /mnt/SHARED/COMMON_DATA <------- the data available on the partition /dev/sda, mounted on /mnt/SHARED/COMMON_DATA

      /mnt/SHARED/MOVIES < -------- the data available on the partition /dev/sdb, mounted on /mnt/SHARED/MOVIES

      /mnt/SHARED/VIDEOS < ---------- the data available on the partition /dev/sdc, mounted on /mnt/SHARED/VIDEOS

      Comment


        #4
        Re: Help needed with NFS exports and bind mounts

        The problem really stems from the Roku box. The "Channel" I use to watch my recorded movies and TV Shows is called RoksBox. It streams directly from the media server, but you can only link it to one primary directory for videos, one for music, and one for photos. It can navigate subdirectories fine but only one primary directory for videos. So if I have Videos and Movies in different locations, I can only use one. Basically - the primary video directory is Videos with Movies, TV Shows, Family Videos, etc under it. This allows the RoxsBox to access all the vids. I like all the subdirectories because I have several hundred (so far ) video files and some structure is helpful.

        The computers aren't a problem because they're all linux, so they can handle what ever setup I use.
        The DLNA server is more configurable than RoksBox so it's really not a factor - it'll do pretty much whatever I want too.

        The partitions are 4TB for movies, 1.5TB for all other videos, and 250GB for photos and music. I initially considered combining the larger two using btrfs, but the 2x1TB drives are several years older than the 2x2TB ones and I'm concerned about data loss due to failures. I backup all the family vids and photos, but the rest is replaceable. Also, it is my understanding that if you use vastly different sized partitions for multidrive btrfs filesystems you loose a considerable amount of overall space (not that I short on that at the moment!).

        So, in my imagination, the dream setup would be Movies nested under Videos. It's just a matter of how best to do it.

        I am hoping for some revelation or a subject matter expert to stumble upon my plight! I am wondering if I can stack bind commands, like

        /mnt/shared /media/Shared
        /mnt/videos /media/Shared/Videos
        /mnt/movies /media/Shared/Videos/Movies

        I guess I should just give it a whirl and see what breaks...

        Please Read Me

        Comment


          #5
          Re: Help needed with NFS exports and bind mounts

          As I suspected, the above doesn't work. Once the first bind is issued, it covers the directories in /media.

          What if I created the bind directories in the previous bind source? Stand by...

          Please Read Me

          Comment


            #6
            Re: Help needed with NFS exports and bind mounts

            Success!

            In case anyone else is interested in this thread - Here's the relevant bits of what I had to do:

            On the server:


            Mount the three partitions:

            in /etc/fstab:
            Code:
            /dev/sdc  /mnt/movies  btrfs  defaults,space_cache,compress  0    2
            /dev/sda6 /mnt/videos  btrfs  defaults,space_cache,compress  0    2
            /dev/sda5 /mnt/shared  ext4  rw,data=writeback,noatime,errors=remount-ro 0  2
            Create mount points for bind mounts
            Code:
            sudo mkdir /mnt/shared/Videos
            sudo mkdir /mnt/videos/Movies

            Bind mounts

            in /etc/fstab:
            Code:
            #
            # BIND mounts for NFS shares
            #
            /mnt/shared /media bind bind
            /mnt/videos /media/Videos bind bind
            /mnt/movies /media/Videos/Movies bind bind
            This creates my desired structure:
            /media/Videos/Movies contains /mnt/movies,
            /media/Videos contains /mnt/videos and the /Movies subdirectory as above,
            /media contains /mnt/shared and the two subdirectories above.

            Now to get all this properly exported via NFS you have to
            Export all the bind subdirectories
            and the "root" bind directory separately:
            in /etc/exports (not relevant options replaced with ... ):
            Code:
            /media 192.168.1.0/255.255.255.0(rw,fsid=0,nohide...)
            /media/Videos 192.168.1.0/255.255.255.0(rw,nohide...)
            /media/Videos/Movies 192.168.1.0/255.255.255.0(rw,nohide...)
            The real important bit here is the fsid=0 which tells the server that this is the "root" file system of the /media exports.


            On the NFS Client:

            You need only mount the "root" export and all the subdirectories follow with it automagically!
            in /etc/fstab:
            Code:
            server://media /shared nfs auto,intr,users,rw,rsize=32768,wsize=32768 0    0
            Now I can keep my stuff well organized and point the Roku RoksBox channel at /media/Videos like before. I don't know how this would translate to SAMBA, but I guess the windows users (guests only!) will have to figure it out...

            <Happily moving files around on his server...>

            Please Read Me

            Comment


              #7
              Re: &lt;SOLVED&gt; Help needed with NFS exports and bind mounts

              Woohoo!

              we see things not as they are, but as we are.
              -- anais nin

              Comment


                #8
                Re: &lt;SOLVED&gt; Help needed with NFS exports and bind mounts

                Slick -- thanks oshunluvr!

                Comment


                  #9
                  Re: &lt;SOLVED&gt; Help needed with NFS exports and bind mounts

                  I smell a How-To note!
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment

                  Working...
                  X