Error with ln (hardlink) in docker


Chrrs

Recommended Posts

I'm having issues with hardlinking with my Sonarr container on unRaid 6.8. While researching this issue, all the posts I've seen say that you should just have one top level mount point in all your dockers. So I created a host path /media that points to /mnt/user, but I still have issues hardlinking. After I changed my volumes mapping, I opened a console to my Sonarr docker and ran ln. This is the error returned:

sh-5.0# ln /media/Downloads/foo /media/TV/bar
ln: failed to create hard link '/media/TV/bar => '/media/Downloads/foo': Invalid cross-device link

This is how the docker is run:

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='binhex-sonarr' --net='bridge' -e TZ="America/New_York" -e HOST_OS="Unraid" -e 'UMASK'='000' -e 'PUID'='99' -e 'PGID'='100' -p '8989:8989/tcp' -p '9897:9897/tcp' -v '/mnt/user':'/media':'rw' -v '/mnt/user/appdata/binhex-sonarr':'/config':'rw' 'binhex/arch-sonarr' 

My docker sees /media as a proper mount point (I think?):

sh-5.0# column -t < /proc/mounts
/dev/loop3  /                          btrfs      rw,relatime,space_cache,subvolid=2312,subvol=/btrfs/subvolumes/eef8c1579c783122fc0f1b5baf4e46cfb71041184f93617c5a848747c7a3c199     0  0
proc        /proc                      proc       rw,nosuid,nodev,noexec,relatime                                                                                                     0  0
tmpfs       /dev                       tmpfs      rw,nosuid,size=65536k,mode=755                                                                                                      0  0
devpts      /dev/pts                   devpts     rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=666                                                                               0  0
sysfs       /sys                       sysfs      ro,nosuid,nodev,noexec,relatime                                                                                                     0  0
tmpfs       /sys/fs/cgroup             tmpfs      ro,nosuid,nodev,noexec,relatime,mode=755                                                                                            0  0
cpuset      /sys/fs/cgroup/cpuset      cgroup     ro,nosuid,nodev,noexec,relatime,cpuset                                                                                              0  0
cpu         /sys/fs/cgroup/cpu         cgroup     ro,nosuid,nodev,noexec,relatime,cpu                                                                                                 0  0
cpuacct     /sys/fs/cgroup/cpuacct     cgroup     ro,nosuid,nodev,noexec,relatime,cpuacct                                                                                             0  0
blkio       /sys/fs/cgroup/blkio       cgroup     ro,nosuid,nodev,noexec,relatime,blkio                                                                                               0  0
memory      /sys/fs/cgroup/memory      cgroup     ro,nosuid,nodev,noexec,relatime,memory                                                                                              0  0
devices     /sys/fs/cgroup/devices     cgroup     ro,nosuid,nodev,noexec,relatime,devices                                                                                             0  0
freezer     /sys/fs/cgroup/freezer     cgroup     ro,nosuid,nodev,noexec,relatime,freezer                                                                                             0  0
net_cls     /sys/fs/cgroup/net_cls     cgroup     ro,nosuid,nodev,noexec,relatime,net_cls                                                                                             0  0
perf_event  /sys/fs/cgroup/perf_event  cgroup     ro,nosuid,nodev,noexec,relatime,perf_event                                                                                          0  0
net_prio    /sys/fs/cgroup/net_prio    cgroup     ro,nosuid,nodev,noexec,relatime,net_prio                                                                                            0  0
hugetlb     /sys/fs/cgroup/hugetlb     cgroup     ro,nosuid,nodev,noexec,relatime,hugetlb                                                                                             0  0
pids        /sys/fs/cgroup/pids        cgroup     ro,nosuid,nodev,noexec,relatime,pids                                                                                                0  0
mqueue      /dev/mqueue                mqueue     rw,nosuid,nodev,noexec,relatime                                                                                                     0  0
shm         /dev/shm                   tmpfs      rw,nosuid,nodev,noexec,relatime,size=65536k                                                                                         0  0
shfs        /config                    fuse.shfs  rw,nosuid,nodev,noatime,user_id=0,group_id=0,allow_other                                                                            0  0
/dev/loop3  /data                      btrfs      rw,relatime,space_cache,subvolid=5,subvol=/volumes/f470c2750a1aca239eb2973f8c442c639dbf88bec93e41eac3391c59abfbf91e/_data           0  0
shfs        /media                     fuse.shfs  rw,nosuid,nodev,noatime,user_id=0,group_id=0,allow_other                                                                            0  0
/dev/loop3  /etc/resolv.conf           btrfs      rw,relatime,space_cache,subvolid=5,subvol=/containers/98b0d21c6c1fd138abc51c274ebbfbd287263161c47953957bc70fd11efd72f7/resolv.conf  0  0
/dev/loop3  /etc/hostname              btrfs      rw,relatime,space_cache,subvolid=5,subvol=/containers/98b0d21c6c1fd138abc51c274ebbfbd287263161c47953957bc70fd11efd72f7/hostname     0  0
/dev/loop3  /etc/hosts                 btrfs      rw,relatime,space_cache,subvolid=5,subvol=/containers/98b0d21c6c1fd138abc51c274ebbfbd287263161c47953957bc70fd11efd72f7/hosts        0  0
proc        /proc/bus                  proc       ro,relatime                                                                                                                         0  0
proc        /proc/fs                   proc       ro,relatime                                                                                                                         0  0
proc        /proc/irq                  proc       ro,relatime                                                                                                                         0  0
proc        /proc/sys                  proc       ro,relatime                                                                                                                         0  0
proc        /proc/sysrq-trigger        proc       ro,relatime                                                                                                                         0  0
tmpfs       /proc/acpi                 tmpfs      ro,relatime                                                                                                                         0  0
tmpfs       /proc/kcore                tmpfs      rw,nosuid,size=65536k,mode=755                                                                                                      0  0
tmpfs       /proc/keys                 tmpfs      rw,nosuid,size=65536k,mode=755                                                                                                      0  0
tmpfs       /proc/timer_list           tmpfs      rw,nosuid,size=65536k,mode=755                                                                                                      0  0
tmpfs       /sys/firmware              tmpfs      ro,relatime                                                                                                                         0  0

Edit: Hardlinking within the same directory gives the same error:

sh-5.0# ln /media/foo /media/bar
ln: failed to create hard link '/media/bar' => '/media/foo': Invalid cross-device link

Edit 2: I think I understand why it's not working. I think I need a top level share under which I'll put my folders. Currently:

Shares:

/mnt/user/Movies

/mnt/user/TV

/mnt/user/Downloads

 

Docker mapping:

/media -> /mnt/user

 

What I need

Shares:

/mnt/user/media/Movies

/mnt/user/media/TV

/mnt/user/media/Downloads

 

Docker mapping:

/media -> /mnt/user/media

 

I will test the above tomorrow and report back if it's working

Edited by Chrrs
Link to comment
  • 4 weeks later...
On 12/16/2019 at 4:42 PM, Chrrs said:

I can confirm the above worked. Leaving this topic open in case it helps someone else with their docker hardlink issues with sonarr, radarr and deluge.

Hello! I've been struggling to get my folder structure and mappings correct for hardlinks for some time now and was hoping you could lend some insight. Looking at the simplicity of yours I feel like I may have gone too far with the folders I have as I am still unable to get the hardlinking working (This was my last attempt at sorting it out

 

These are my current mappings and am currently just going off Radarr but will configure Sonarr the same once I get one working

image.png.4b433dd0b75f4efeb482c7e69d598438.png

 

The folders I have setup are under one share "Storage" and in there are 2 folders, a Torrents folder and a Media folder (And some other things not relevant)
image.png.6855ed4418a624fa2648cb5350e54f36.png

 

Each folder, torrents&media are laid out in with the same folders, and a couple extras in the torrents folder for stuff not downloaded from sonarr/radarr.

image.png.acf5f0393c724e884d4dd3af569555fd.pngimage.png.fd8d9f4273297ade840b6fddf0ed8e9f.png

 

The reason there are many is because of how I have my sorting setup in Plex, and had intended to have deluge move the completed ones to their respective folders depending on the label they are downloaded with from Radarr/Sonarr. But yeah, am I close to having it sorted out? Would I just need to change my Sonarr /Media map to /mnt/user/storage/media ? Would that affect which folder the completed downloaded are hardlinked into?

Any help is greatly appreciated.

 

 

 

Link to comment

I'm going to try having my download folders (completed, incomplete, unzipped_torrents) inside my /mnt/user/Storage/Media similar to how he's done it above and see how that goes.

 image.png.dad22b80ccb14bb7beebc37380c9bc01.png

Haven't stopped the containers and updated the paths but will give it a shot later today and post if everything is working or not.

Link to comment

So i've changed my folder to use what I listed above and updated my mappings to:
tempsnip.thumb.png.665d02ae38d3eb80068178a183d80ebe.png

Downloaded something and still saw the size on my cache drive increase double what the file was. Is this because I don't have Media as my top level of the share and it being a folder in the greater "Storage" share which then has other files not related to my media? I feel like that is the only difference I am noticing now and was wondering if anyone has any ideas?
image.png.926ce40999da9cad1f034755c376ab98.png
I double checked to make sure I am not a big dumb and Hardlinking is still enabled in Radarr

 

EDIT: Tried moving everything to top level of the share which is now named Media (not Storage) and these are my shares:
/mnt/user/Media/Movies

/mnt/user/Media/TV

/mnt/user/Media/Completed

 

The completed folder is the one my downloads move to when they're complete.

 

Docker mappings:

Deluge

/data -> /mnt/user/Media/

 

Radarr/Sonarr

/data -> /mnt/user/Media/

/media -> /mnt/user/Media/

Am at a bit of a loss again.

 

Edited by Skrie
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.