Hardlinking folders on Unraid share


Recommended Posts

I have folders with files in the same user share, and I want to hard link them to a separate subfolder (for PLEX / renaming)

What's the easiest way to do this? I can't see an easy way either Krusader or Midnight Commander

 

In Windows I used Link Shell Extension to hard-link folders on my QNAP SMB share for PLEX; but unfortunately Link Shell Extension doesn't seem to work on my Unraid SMB share.

 

Thanks

Edited by Ivegottheskill
Link to comment

I'm open to anyone with an easier & better way, but the only solution I've found so far is to type the following at the console.

It'll be a very slow process to go through my entire share vs. the simplicity of Link Shell Extension, but it works (i.e. PLEX can see the files):

 

Example:

Quote

for stuff in /mnt/user/Unraid/Torrents/Seinfeld.S01*; do ln "$stuff" "/mnt/user/Unraid/PLEX/TV/Seinfeld/Season 1"; done;

 

Link to comment

Far be it from me to tell you to change your storage structure, but the "easiest" way to do anything is to have the correct file structure for Plex to begin with.

 

And/Or why do you even need/want Plex scanning your hard links and not the media itself?  Seems like you're causing more trouble for yourself.

 

 

Link to comment

Thanks for your reply

 

The primary reason is for torrent seeding. I seed everything in my Torrents folder, but I want to rename and restructure it so that Plex indexes it properly, which rarely happens if I let Plex index the downloads folder directly (due to poor or incorrect file naming structures etc).

 

My understanding is that Sonaar and Radaar do this hardlinking automatically for Plex. I intend to install them a bit later and use them going forward, but I already have a significant media library. I'd rather not re-download everything via Sonaar / Radaar.

Link to comment
5 minutes ago, Ivegottheskill said:

I seed everything in my Torrents folder, but I want to rename

Pretty sure this will break the torrent. How could it not since the torrent relies on nothing being changed to maintain integrity. Unless you planned to start a new torrent instead, which wouldn't contribute to your seed ratio on the original.

Link to comment
10 minutes ago, trurl said:

Pretty sure this will break the torrent. How could it not since the torrent relies on nothing being changed to maintain integrity. Unless you planned to start a new torrent instead, which wouldn't contribute to your seed ratio on the original.

Hi

 

I think you may have misunderstood my original post. My objective is to hardlink of all my media files in my Torrent folders to a Plex folder in the same share. Once done, I can rename and reorganise as required for Plex to index them, while the "originals" stay unaltered in my torrent folder.

 

Best of both worlds

Link to comment
1 hour ago, trurl said:

So when you say "rename and reorganize", you are just talking about the folders that contain the hardlinks?

Yes that's right. I leave the Torrent folders and all the files in them untouched so I can continue seeding. I then create hardlinks of those in a separate folder called "Plex" (with sub folders for TV, movies), and then rename the hardlinks so that Plex picks them up and indexes them correctly.

 

I've been doing it for a few years on my old 4-bay QNAP and it worked well. It's also been working so for me so far in Unraid over the past couple of days using the command line method I mentioned in my 2nd post, but I was curious if there was an easier / alternative method to collectively hardlink a large number of files and folders.

 

I'm wondering if I'll run into any issues as my share grows in size, since I know hardlinks don't work across different volumes. User shares can span multiple drives. Since it's working for me right now hardlinking within the user share, I imagine that it might only ever be a problem when I'm near a tipping point for the 'High Water'  file allocation: Unraid might helpfully try to put my new hardlink on a hard drive with more free space? 🤷‍♂️

 

If that happens though I'd know as the hardlink simply wouldn't appear. But since hardlinks take up so little (basically 0) space, it might not even be a problem. If it ever happens to me, I'll post back here. At least then it might be a useful reference for someone in the future

Edited by Ivegottheskill
  • Like 1
Link to comment
  • 2 months later...
On 9/1/2020 at 4:11 AM, Ivegottheskill said:

Yes that's right. I leave the Torrent folders and all the files in them untouched so I can continue seeding. I then create hardlinks of those in a separate folder called "Plex" (with sub folders for TV, movies), and then rename the hardlinks so that Plex picks them up and indexes them correctly.

 

I've been doing it for a few years on my old 4-bay QNAP and it worked well. It's also been working so for me so far in Unraid over the past couple of days using the command line method I mentioned in my 2nd post, but I was curious if there was an easier / alternative method to collectively hardlink a large number of files and folders.

 

I'm wondering if I'll run into any issues as my share grows in size, since I know hardlinks don't work across different volumes. User shares can span multiple drives. Since it's working for me right now hardlinking within the user share, I imagine that it might only ever be a problem when I'm near a tipping point for the 'High Water'  file allocation: Unraid might helpfully try to put my new hardlink on a hard drive with more free space? 🤷‍♂️

 

If that happens though I'd know as the hardlink simply wouldn't appear. But since hardlinks take up so little (basically 0) space, it might not even be a problem. If it ever happens to me, I'll post back here. At least then it might be a useful reference for someone in the future

I use Sonarr and Radarr for this.
It might be what you've been looking for.

And thanks for the command, I'm going to test it now :)

Link to comment
  • 2 weeks later...
On 11/10/2020 at 12:23 AM, Nanobug said:

The hardlink command didn't work for me :/

 

"hard link not allowed for directory"

Hi Nanobug,

 

Glad you posted this in here. Yes, the original command only hardlinks directory contents, it won't hardlink the whole directory unfortunately.

Since my earlier post I found and use this command as an easier way to get around this and hardlink entire directories to my PLEX folder.

 

Quote

cp -al /mnt/user/Unraid/Tracker1/TVShow /mnt/user/Unraid/PLEX/TVShow

 

Sure, Sonarr / Radarr does this in the background, but:

a) I haven't used either (yet)

b) I have a lot of content already downloaded "manually" over the years, which I assume Sonarr and Radarr won't automatically & retroactively detect and hardlink by itself

c) I find this extremely useful for both my PLEX folders and for other applications, such as cross-seeding of torrents on different trackers where the files or folder structures have been altered.

Edited by Ivegottheskill
Link to comment
24 minutes ago, Ivegottheskill said:

Hi Nanobug,

 

Glad you posted this in here. Yes, the original command only hardlinks directory contents, it won't hardlink the whole directory unfortunately.

Since my earlier post I found and use this command as an easier way to get around this and hardlink entire directories to my PLEX folder.

 

 

Sure, Sonarr / Radarr does this in the background, but:

a) I haven't used either (yet)

b) I have a lot of content already downloaded "manually" over the years, which I assume Sonarr and Radarr won't automatically & retroactively detect and hardlink by itself

c) I find this extremely useful for both my PLEX folders and for other applications, such as cross-seeding of torrents on different trackers where the files or folder structures have been altered.

I use both sonarr and radarr, and you can just import the folders, and it will hard link it.
I just have an issue with my radarr for some reason, when I try to import the resident evil movies, it does not hard link it to anywhere. I'm trying to figure out why, but I haven't figured it out yet.

A question about the hard link. Will it automatically hard link it?

For example:
/data/download/movies/
and it hard links it to

/data/media/movies/

 

If I add more content in the /data/download/movies/ will it automatically show up in /data/media/movies/ ?

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.