[HARDLINK] Help understanding filesystems vs volumes on Syn NAS

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
thedigitalhobo
Posts: 1
Joined: 19 Apr 2024, 14:01

[HARDLINK] Help understanding filesystems vs volumes on Syn NAS

Post by thedigitalhobo »

I thought I had a basic understanding of what was considered a filesystem, but obviously I was wrong.
I'm trying to get up to speed on FileBot, and running a few different instances to learn the ins and outs. I've got a docker container on a RPi, accessing it via web GUI, the Windows desktop app, and installed the Synology package on my NAS to try and address some of the issues I was bumping into.

My main question is why Filebot and/or Synology are treating Shared Folders (NFS) as different filesystems. I thought they'd be treated as the same.

I set up an NFS share on /NAS/volume1/plexstuff where I hoped to keep the hardlinks to the renamed files and assets from /NAS/volume1/video, which is where my current movie library is stored.

I initially tried to write the hardlinks via my docker instance, but discovered that each mounted folder in docker was treated as a separate filesystem. So I learned that Filesystems don't just mean the same type (EXT4 vs NTFS vs BRTFS), but has to be the same physical filesystem. OK.

Code: Select all

[HARDLINK] from failed due to I/O error Invalid cross-device link]
Tried the same thing from the Windows desktop app. Same result. So the NFS network shares are treated the same.

Installed the Synology package, and this is where I was surprised. I created a "pristine" folder for my test, but still couldn't create hardlinks from /NAS/volume1/video to /NAS/volume1/plexstuff. But can create hardlinks from /NAS/volume1/video/movies/ to /NAS/volume1/video/plexstuff -- within the same shared folder.

Is that the expected behavior? Can anyone share a link to an explanation so I can wrap my head around it?

Thanks!
User avatar
rednoah
The Source
Posts: 23021
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help understanding filesystems vs volumes on Syn NAS

Post by rednoah »

thedigitalhobo wrote: 19 Apr 2024, 14:20 My main question is why Filebot and/or Synology are treating Shared Folders (NFS) as different filesystems. I thought they'd be treated as the same.
Keep in mind that FileBot itself is not doing file system operations. FileBot is politely asking the OS to perform an operation (e.g. hardlink A to B) and then the OS is using the file system implementation to make that happen on disk. Invalid cross-device link is the error that FileBot gets back from the OS when the OS cannot perform the requested operation.



:idea: If you're using docker, then each -v volume mount is a different file system from the point-of-view of the OS running inside the container. Hence Invalid cross-device link if you try to link across file system boundaries as seen by the containerized OS. See Notes on --action MOVE and --action HARDLINK for details.


:idea: A network share works much the same way. If you map two folders that are on the same file system on your NAS as X:/ and Y:/ on Windows, then Windows will see two separate drives / file systems and perform all operations accordingly. (e.g. move = extremely slow download from X:/ and upload to Y:/ and then delete on X:/ even though the remote host file system on the server - knowing things the client cannot know - could perform the operation instantly without read / writing any file contents)



:idea: You can use the stat command to see if two files / folders are on the same file system:

Console Output: Select all

$ touch a.txt
$ ln a.txt b.txt
$ stat a.txt b.txt
  File: ‘a.txt’
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 105384095   Links: 2
...
  File: ‘b.txt’
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: fd00h/64768d	Inode: 105384095   Links: 2
...
If Device is not the same, then ln will print the "Invalid cross-device link" error message.



:?: What does stat say? (NOTE: stat the relevant context; relevant as-in in the same context in which filebot is running)


:?: You seem to have manually typed or modified the error message. What does the error message say verbatim? (NOTE: the error message should tell us the file paths as at hand but you seem to have removed that information)

Error: Select all

[HARDLINK] from [A] to [B] failed due to I/O error [A -> B: Invalid cross-device link]
:idea: Please read the FAQ and How to Request Help.
Post Reply