Hard Links not working

Sonarr version (exact version): 4.0.11.2680
Mono version (if Sonarr is not running on Windows): 6.0.13
OS: Linux Mint 21 (but ready to upgrade to 22 since pyMedusa is broken now, it was the only thing holding me back)
Debug logs: Below
Description of issue:

Hard links aren’t working, it’s copying the file instead. I am trying to hard link to a different directory on the same drive. The directory called “1Unsorted” is where Qbittorrent puts the downloads. The directory “0Sorted” is the directory of shows, where each show has its own directory, and there are directories under those numbered by each season. This was working under Medusa, where everything in the 0Sorted directory of shows was owned by user medusa and group medusa - but there weren’t any actual files in those folders, it was just a bunch of links so that Plex could index it easily. Both the 0Sorted and the 1Unsorted directories are set to 777 permissions. The drive mount is owned by my main login account’s username, and owned by the group that has the same name as my username, but I’ve got the top level of the whole drive mount set to 777. I tried adding sonarr to the group that’s the same name as my username. I’m using Qbittorrent, and I’m running everything natively, no containers. The files that Qbittorrent downloads are owned by my account’s username and the group that has the same name as my username, with permissions 664. I started setting up Sonarr by having it import my existing Medusa show folders, but I also have gone ahead and deleted one of those folders, then had Sonarr re-add it - so now Sonarr is owner of the show directory in the example below, but I’m still having the same problem. (My OS is on an SSD, this media drive is an HDD. I do have symlinks in ~/Videos/ on the SSD to this DVR directory on the HDD, and I had tried using those ~/Videos/DVR/ paths at first - but I switched it to the absolute HDD mount paths shown below, and I’m still having the same problem.)

Debug log lines are below.

Thank you!!

2024-12-09 23:09:59.2|Debug|EpisodeFileMovingService|Attempting to hardlink episode file: /media/[my_username]/[drive_mount_name]/Videos/DVR/1Unsorted/[episode_file_name].mkv to /media/[my_username]/[drive_mount_name]/Videos/DVR/0Sorted/[show_name]/Season 4/[episode_file_name].mkv
2024-12-09 23:09:59.2|Debug|DiskTransferService|HardLinkOrCopy [/media/[my_username]/[drive_mount_name]/Videos/DVR/1Unsorted/[episode_file_name].mkv] > [/media/[my_username]/[drive_mount_name]/Videos/DVR/0Sorted/[show_name]/Season 4/[episode_file_name].mkv]
2024-12-09 23:09:59.2|Debug|DiskProvider|Hardlink ‘/media/[my_username]/[drive_mount_name]/Videos/DVR/1Unsorted/[episode_file_name].mkv’ to ‘/media/[my_username]/[drive_mount_name]/Videos/DVR/0Sorted/[show_name]/Season 4/[episode_file_name].mkv’ failed.

[v4.0.11.2680] System.InvalidOperationException: Operation not permitted
—> Mono.Unix.UnixIOException: Operation not permitted [EPERM].
— End of inner exception stack trace —
at Mono.Unix.UnixMarshal.ThrowExceptionForLastError()
at Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf(Int32 retval)
at Mono.Unix.UnixFileSystemInfo.CreateLink(String path)
at NzbDrone.Mono.Disk.DiskProvider.TryCreateHardLink(String source, String destination) in ./Sonarr.Mono/Disk/DiskProvider.cs:line 444

2024-12-09 23:10:00.1|Debug|EpisodeService|Linking [Season 4/[episode_file_name].mkv] > [[10748]Patience]
2024-12-09 23:10:00.2|Debug|CompletedDownloadService|All episodes were imported for [episode_file_name].mkv
2024-12-09 23:10:00.2|Debug|DownloadEventHub|[[episode_file_name].mkv] Marking download as imported from qBittorrent

The operation is rejected by the file system, it sounds like they’re on different volumes or mount points and Sonarr cannot hardlink. It’s possible it’s permissions, but I think you’d get a permission error, not a failure that way.

Thank you for the reply markus101, I appreciate it. They’re not on different volumes though, it’s the same volume on the same drive. It’s even two different subdirectories underneath the same directory. Qbittorrent puts the downloads in [mount_point]/Videos/DVR/1Unsorted, and I’m trying to get Sonarr to put hardlinks in [mount_point]/Videos/DVR/0Sorted/[Show Name]/[Season number]/.

A few more questions from the support gurus on Discord, you may be able to get faster help there directly depending on who’s around.

What file system are you using?
You said you set a number of folders to 777, did you do that recursively?
Is qbit running as the right user/group with the correct umask being applied to files?

Thank you markus, I may try to hop into Discord. I use ext4. The files that Qbittorrent downloads are owned by my account’s username and the group that has the same name as my username, with permissions 664. So the files in that downloads directory aren’t set to 777. I made the sonarr user a member of the group that is the same name as my username, and I made my user a member of sonarr’s media group. My DVR directory, where both the Qbit downloads and the shows directory are subdirectories, is set to 777, and is owned by user nobody, group nogroup. umask is 0002.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.