Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want hard links only, no copies. #6260

Open
1 task done
Snake883 opened this issue Dec 18, 2023 · 22 comments
Open
1 task done

Want hard links only, no copies. #6260

Snake883 opened this issue Dec 18, 2023 · 22 comments

Comments

@Snake883
Copy link

Is there an existing issue for this?

  • I have searched the existing open and closed issues

Is your feature request related to a problem? Please describe

When importing, I do NOT want copies. I want hard links only.

Describe the solution you'd like

I want Sonarr to hard link the file, or throw an error.

Describe alternatives you've considered

Couldn't find an alternative.

Anything else?

Sonarr v3.0.10.1567
Linux

@augustuen
Copy link
Contributor

augustuen commented Dec 18, 2023

This sounds more like a configuration issue. With a properly configured setup, Sonarr should always use hardlinks.

Please use one of the official support channels like Discord or the Sonarr forum instead.

@Snake883
Copy link
Author

This sounds more like a configuration issue. With a properly configured setup, Sonarr should always use hardlinks.

There are circumstances that even a properly configured setup can cause Sonarr to copy.

Very simple: If the user wants Sonarr to hard link, then only allow hard linking. Do not even allow copying. If that cannot easily be achieved, at least provide an error/warning message.

Proposal:
In the import mode drop down box:
Remove the option "hardlink/copy files".
Only options are: "Move", "Hardlink", "Copy".

If either of those options is not successful, inform the user of an error, exit import process. Do NOT switch import modes.

Thank you.

@markus101
Copy link
Member

There are circumstances that even a properly configured setup can cause Sonarr to copy.

Can you elaborate with examples?

In the import mode drop down box

Is your issue only with Manual Import?

Only options are: "Move", "Hardlink", "Copy".

I see no reason to remove Hardlink/Copy and require the majority of users to manually differentiate.

@Snake883
Copy link
Author

sounds more like a configuration issue

How is the user going to easily know if there is a configuration issue?
How is the user going to know Sonarr is not hardlinking? But copying?

When there is a filesystem configuration problem, the error from Sonarr will alert the user of the problem. And then the user can be responsible for the configuration. But the user needs to know.

Can you elaborate with examples?

When a file has the immutable flag set.

Is your issue only with Manual Import?

Manual import.

I see no reason to remove Hardlink/Copy and require the majority of users to manually differentiate.

Manually differentiating already happens.

I have already configured "Hardlinks instead of copy":
image

Yet when manually importing, I still have to select a choice:
image

And then:
image

The problem is Sonarr tries to hardlink, and if it cannot create a hardlink, it will automatically copy the file, and without notifying the user. I simply don't want it to copy at all if I have selected Sonarr to hardlink.

I am thinking the solution could be simple: separate hardlinking from copying.
Options are: "Move", "Hardlink", "Copy".

Also for new users, they won't find their entire library unexpectedly copied when expecting hardlinks. I had this happen when I first started out, and then went through the confusion of configuring Sonarr, folder structures, and setting up my NAS correctly (which can have links to pooled folders on different physical drives.

Hardlinks vs. copies are not easy to mass identify, and risky to correct (requiring deletes).
Peventing the problem is best.

@fryfrog
Copy link

fryfrog commented Dec 18, 2023

Would it be fair to summarize your very high level issue is that you thought you had a hard links setup, but didn't. But this is very hard to realize, both investigating yourself and in sonarr/radarr where there are no indicators? It is fine to think about solutions, but it helps a lot to step way back and look at the high level problem so we can figure out a variety of approaches.

As someone who cares a lot about hard links, this has been an issue for years and years and years and I think it would be great to help people end up w/ a good setup that supports hard links and instant moves. :)

@thezoggy
Copy link

the importing section is what is done by default when the system is auto importing.

the manual import, the option are there is to provide flexibility for the scenario rather than not give an option and force the user to dig into settings to change it.

@arkayenro
Copy link

Would it be fair to summarize your very high level issue is that you thought you had a hard links setup, but didn't. But this is very hard to realize, both investigating yourself and in sonarr/radarr where there are no indicators?

not my issue, just responding because i think its a good idea.

yes, that big picture description sounds about right for me.

i presumed i had mine setup for hardlinks but the only way i could think to confirm was to watch a torrent being copied across - if it took a couple of seconds to turn up (and the file size incremented) then it was copying, if it turned up instantly at full size then it was hardlinking. even then though some werent large enough to tell so it wasnt exactly good confirmation.

theres probably some way to tell at the os level that the file is a hardlink or not but i use a synology nas and while i could get in there and check via ssh its not really something that should need to happen.

its probably simpler to update the log entry output to indicate which method, copy or hardlink, was used for copying that file, at least then the users are capable of seeing for themselves that while they thought they had their system setup correctly for hardlinking, it seems they actually dont.

ie, if you really want people to use hardlinking then shouldnt you make it easy for them to find out if they (sonarr or radarr) are or not?

@Hannah-GBS
Copy link

Would it be too much bloat to show (or have a config option to show) the import method on the post-Import info screens?

image

image

@sn0rlacks
Copy link

sn0rlacks commented Jan 14, 2024

+1 to this. I find in my current setup (v4.0.0.748), copies are still happening when logs depict hardlinking is working fine. How do I know this?

2024-01-14 08:51:06.4|Debug|EpisodeFileMovingService|Hardlinking episode file: /usr/local/share/media/downloads/Downton.Abbey.S02.1080p.BluRay.x264-TENEIGHTY/teneighty-dta.s02e06.mkv to /usr/local/share/media/tv/Downton Abbey/Season 2/teneighty-dta.s02e06.mkv

2024-01-14 08:51:06.4|Debug|DiskTransferService|HardLinkOrCopy [/usr/local/share/media/downloads/Downton.Abbey.S02.1080p.BluRay.x264-TENEIGHTY/teneighty-dta.s02e06.mkv] > [/usr/local/share/media/tv/Downton Abbey/Season 2/teneighty-dta.s02e06.mkv]`

See this line when doing cat sonarr.debug.log | grep Hard It outlines that everything is working. I also grep for "fail" and nothing returns. However, my disk is always resulting in ++ the size of the original media. I.e I had 500GB of data on my disk, my new series is 200GB (and already on the disk), and after sonarr imports it from /downloads to /tv (assuming hardlink by the logs), my used space turns to 700GB.

This seems indicative of an underlying problem I'd like to address, but to combat it, having this suggestion be implemented would def help. Don't want sonarr just doubling my disk size, i'd rather it halt and tell me, or give me the option to enable this (to your point of not troubling the standard OOB UEX).

@bakerboy448
Copy link
Contributor

and after sonarr imports it from /downloads to /tv

Any and all documentation from sonarr's docs to the wiki to trash guides to LSIO's own readme says to avoid this path setup if you want hardlinks.

@sn0rlacks
Copy link

and after sonarr imports it from /downloads to /tv

Any and all documentation from sonarr's docs to the wiki to trash guides to LSIO's own readme says to avoid this path setup if you want hardlinks.

Can you elaborate? See log message in post. Directories on different, root dir is tv and downloads dir is downloads. Isn't that explicitly what the docs say to do?

Also, why wouldn't the debug logs tell me this when it is running DiskTransferService?

@Hannah-GBS
Copy link

and after sonarr imports it from /downloads to /tv

Any and all documentation from sonarr's docs to the wiki to trash guides to LSIO's own readme says to avoid this path setup if you want hardlinks.

Can you elaborate? See log message in post. Directories on different, root dir is tv and downloads dir is downloads. Isn't that explicitly what the docs say to do?

Also, why wouldn't the debug logs tell me this when it is running DiskTransferService?

From LSIO:
We have set /tv and /downloads as optional paths, this is because it is the easiest way to get started. While easy to use, it has some drawbacks. Mainly losing the ability to hardlink

From Sonarr wiki:
Most Docker images suggest paths like /tv and /downloads. This causes slow moves and doesn't allow hard links because they are considered two different file systems inside the container. Some also recommend paths for the download client container that are different from the Sonarr container, like /torrents.

From Trash:
The default path setup suggested by some docker developers that encourages people to use mounts like /movies, /tv, /books or /downloads is very suboptimal and it makes them look like two or three file systems, even if they aren’t (Because of how Docker’s volumes work). It is the easiest way to get started. While easy to use, it has a major drawback. Mainly losing the ability to hardlink or instant move, resulting in a slower and more I/O intensive copy + delete is used.

@bakerboy448
Copy link
Contributor

bakerboy448 commented Jan 14, 2024

Most Docker images suggest paths like /tv and /downloads. This causes slow moves and doesn't allow hard links because they are considered two different file systems inside the container.

@sn0rlacks
Copy link

Should have been more explicit. This is truenas core running on baremetal. I have 1 dataset called media, within it 3 dirs. tv, movie, downloads. I mount with full control perms to a FreeBSD Jail, and then ACL the *arr group to have full read/write on it. Is this what makes it docker-like? I saw Trash guides mention this for truenas scale, but core has its own section.
https://trash-guides.info/Hardlinks/How-to-setup-for/TrueNAS-Core/

This line you shared does perplex me though

We have set /tv and /downloads as optional paths

Does this mean if you name your dirs this way, regardless, hardlinks wont work?

@bakerboy448
Copy link
Contributor

bakerboy448 commented Jan 14, 2024

Naming has nothing to do with it. It is impossible to hardlink across multiple mounts/filesystems

Unfortunately very few bsd users exist, so you'll need to rely on the TrueNAS core community or yourself for support

logs indicate that it will attempt to hardlink or copy. The user knows whether or not their setup supports hardlinks copies if they read the documentation.

@sn0rlacks
Copy link

sn0rlacks commented Jan 14, 2024

Alas the suggestion still is valid in my opinion, your logs don't indicate there is an issue with Hardlinking. If it tries and failsover to copy, some kind of line or halt would be beneficial. Knowing it attempted one or the other but not knowing what it chose is only somewhat useful.

@sn0rlacks
Copy link

Fixed my issue, even though the local OS thinks everything is mounted to 1 place, it was 3 separate mounts from the iocage side. I just mounted ONLY the root media to the jail and now everything works since subdir structure is the same.

Thanks for your help @bakerboy448

@bakerboy448
Copy link
Contributor

16e5ffa Clarified the misleading hardlink messaging

@Dukobpa3

This comment was marked as off-topic.

@bakerboy448

This comment was marked as off-topic.

@Dukobpa3

This comment was marked as off-topic.

@bakerboy448

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants