Combining 2 host paths into one container path, is it possible?


Nexen

Recommended Posts

Hello,

Because of the way Ubooquity works it would be really helpful if I could have the contents of 2 different host paths show up as one container path in the Ubooquity Docker container.

For example:
Host path 1: /mnt/user/x
Host path 2: /mnt/user/y
Show up as /z for the Ubooquity Docker container.

I've tried adding both and pointing them to the same container path but that just gives an error when trying to start the container.

The container path would be fine as Read Only and both host paths have some duplicate directories but never duplicate files if that matters.

I'm assuming there's probably a command to either mount it that way for the container as it starts or create a directory in Unraid that shows the contents of those 2 directories but I'm not very familiar with Docker or Linux filesystems. Does anyone have any ideas?

Link to comment
1 minute ago, tjb_altf4 said:

You can easily do it so your two paths appear like so:

/z/x and /z/y

i.e. both folder exist under the same root folder, would that work?

Thank you for your reply, but unfortunately that wouldn't help much, basically the 2 paths I'm trying to show up as one have the same directory structure with publisher folders but different files. It's because one gets backed up to a remote location and the other doesn't, but rather than have both paths show up as different libraries/folders in Ubooquity it would be great if it could show up as one path.

Link to comment
23 minutes ago, tjb_altf4 said:

If you kept the two structures on seperate disks, but in the same share (top level folder), Unraid would merge structures for you as part of how it manages its shares.

Might take some further research to get right, but that sounds like what you want.

I guess that would work but then the problem with that would be when I add more books or comics, that's normally automatically handled over SMB by a VB.NET application i wrote in which case i can't control to which disk it goes unless I'm missing something and you can access the disks over SMB too.

Link to comment

No, both paths get updated as the application decides where each file goes by recognizing existing series folders to add to, but I can probably just alter my application to use SFTP from SSH.NET instead of SMB so it can can write directly to the disks.

Link to comment
7 hours ago, Nexen said:

Because of the way Ubooquity works it would be really helpful if I could have the contents of 2 different host paths show up as one container path in the Ubooquity Docker container.

So I basically understand what you want to do, but I don't think what you want to do is possible... at least not exactly how you want it.  The only thing I can think of that would sort of give you want you want is to have the same (user) share on two different disks.  And then you access them by the disk share (only) and not the user share.  This could get kind of messy.

 

So instead of /mnt/user/BookShare/Author you'd use

/mnt/disk1/BookShare/Author --- remote backup share

/mnt/disk2/BookShare/Author ---- no remote backup

 

and both "versions" would be listed through SMB in the user share /BookShare/ for read only access, and the disk shares for write access... you would want the user share read only at all times because if you start writing to user shares and disk shares you can run into versioning problems.  This is not the recommended way to use Unraid shares.

 

Also, let me pose this to you --- is your main problem here the ability of Ubooquity to display the contents of both paths? Since by default it has /books and /comics but you have two different physical paths that you want displayed under /books, correct?  That's really the only thing you're trying to solve?

 

That's a lot easier ...............................

 

Edit your Ubooquity docker container to add the second path.  So you have /books, /comics, and /unsynced_books_path which maps to whatever path you have.

 

Then, if you are using the standard Ubooquity ports, go to the admin page at ip:2203/ubooquity/admin and under the Books tab add the new path /unsynced_books_path as a shared path and save.  Now all the books from /books (your backed up path) and /unsynced_books_path (your non-backed up path) are now displayed under the Books category in Ubooquity.

 

And I think that's what you are actually trying to achieve.

 

 

 

 

Link to comment
6 hours ago, Energen said:

Edit your Ubooquity docker container to add the second path.  So you have /books, /comics, and /unsynced_books_path which maps to whatever path you have.

 

Then, if you are using the standard Ubooquity ports, go to the admin page at ip:2203/ubooquity/admin and under the Books tab add the new path /unsynced_books_path as a shared path and save.  Now all the books from /books (your backed up path) and /unsynced_books_path (your non-backed up path) are now displayed under the Books category in Ubooquity.

 

And I think that's what you are actually trying to achieve.

I know what you mean but then it would still just show up as 2 different folders in Ubooquity called "books" and "unsynced_books_path" with the same folder structure for publisher but different series.

 

I've been experimenting with symlinks, I made a script that loops through both dirs and creates symlinks for each series in each publisher folder so i could mount that merged folder in Ubooquity, and while it does work and creates a working directory when browsed in SMB or in MC when I mount it as a container path it doesn't show the symlinks and only empty publisher dirs in Ubooquity.

 

I'll include the script in case it's because of an error in that, especially since it's my first time using Bash or any non-.NET language even so i'm not sure if this is the most effective script.

 

#!/bin/bash

DIR1="/mnt/user/ubooquity/comics/publishers/"
DIR2="/mnt/user/backups/rsync/ubooquity/comics/publishers/"
MERGEDDIR="/mnt/user/ubooquity/merged/"

#UNLINK PREVIOUS
find "$MERGEDDIR" -type l -exec unlink {} \;

#DIR1
for PublisherDir1 in "$DIR1"*; do
  if [ -d "$PublisherDir1" ]; then
    PublisherName1=$(basename -- "$PublisherDir1")
    for SeriesDir1 in "$PublisherDir1/"*; do
      if [ -d "$SeriesDir1" ]; then
        SeriesName1=$(basename -- "$SeriesDir1")
        [ ! -d "$MERGEDDIR$PublisherName1" ] && mkdir "$MERGEDDIR$PublisherName1"
        ln -s "$SeriesDir1" "$MERGEDDIR$PublisherName1/$SeriesName1"
      fi
    done
  fi
done

#DIR2
for PublisherDir2 in "$DIR2"*; do
  if [ -d "$PublisherDir2" ]; then
    PublisherName2=$(basename -- "$PublisherDir2")
    for SeriesDir2 in "$PublisherDir2/"*; do
      if [ -d "$SeriesDir2" ]; then
        SeriesName2=$(basename -- "$SeriesDir2")
        [ ! -d "$MERGEDDIR$PublisherName1" ] && mkdir "$MERGEDDIR$PublisherName2"
        ln -s "$SeriesDir2" "$MERGEDDIR$PublisherName2/$SeriesName2"
      fi
    done
  fi
done

 

 

Edited by Nexen
Adjusted the code snippet format to make it easier to read
Link to comment

To further clarify the script does exactly what I wanted actually.

 

For example if DIR1 has /mnt/user/ubooquity/comics/publishers/PublisherA/SeriesA
and DIR2 has /mnt/user/backups/rsync/ubooquity/comics/publishers/PublisherA/SeriesB
then MERGEDDIR will display both SeriesA and SeriesB in it's PublisherA folder.

 

And whenever big changes are made to either DIR1 or DIR2 or a new series folder is added I can just have the script run again to update all symlinks.

 

The only problem now is that the symlinks don't show up in Ubooquity. I've also just tried it with Plex and it recognizes the symlinks as generic files, not directories. So in case there is no way to have Docker read symlinks I guess my backup plan could be to run Ubooquity in a VM that accesses the merged directory of symlinks over SMB, which would be a less elegant and efficient solution than I had hoped.

Edited by Nexen
Link to comment

After some trial and error it seems I finally figured it out, I can use my script to create the merged folder and then open the console on the running privileged Ubooquity Docker container and enter the following line:

 

apk update && apk add --upgrade cifs-utils && mkdir /comics/merged && mount -t cifs //192.168.0.23/ubooquity/merged /comics/merged -o user=XXX,password=XXX

 

And now the merged folder is available at /comics/merged with the symlinks working perfectly.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.