6

I have a CIFS network mount (ext4 on Synology NAS share), and I can't work out why I can't make hard links on that volume – the command is successful and results in a new file, but the new file has its own new inode:

cd /mnt/ds220j
touch hardlinktest.txt
ln hardlinktest.txt hardlinktest2.txt
ls -li .
=>
 1895784 -rwxrwx--- 1 dietpi dietpi  0 Aug  8 09:54  hardlinktest2.txt*
 1895763 -rwxrwx--- 2 dietpi dietpi  0 Aug  8 09:54  hardlinktest.txt*

find . -type f -links 2
=> 
./hardlinktest.txt

find . -type f -samefile ./hardlinktest.txt
=> 
./hardlinktest.txt

ls -li .
=> 
 1895784 -rwxrwx--- 1 dietpi dietpi  0 Aug  8 09:54  hardlinktest2.txt*
 1895763 -rwxrwx--- 1 dietpi dietpi  0 Aug  8 09:54  hardlinktest.txt*

Curiously, the links count initially increments to 2 on the original file, and I can find it using find -links 2, but then afterwards the links count reverts to 1 again and find -links 2 comes back empty.

Mount options via /proc/mounts:

//REDACTED-IP/GLaDOS /mnt/ds220j cifs rw,relatime,vers=3.1.1,cache=strict,username=REDACTED,uid=1000,noforceuid,gid=1000,noforcegid,addr=REDACTED,file_mode=0770,dir_mode=0770,iocharset=utf8,soft,nounix,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=5 0 0

For what it's worth, hard links on the root fs do work just fine.

Any help greatly appreciated 🙏

2
  • Do you have anything else running that might be trying to do versioning or compression of files that doesn't understand hardlinks?
    – DopeGhoti
    Commented Aug 7 at 23:44
  • @DopeGhoti no, nothing like that. This is on a raspberry pi being used for home automation, and it's running a DNS server and a bunch of docker containers but nothing that deals with versioning or compression, especially on the mount point.
    – 6twenty
    Commented Aug 8 at 2:07

1 Answer 1

8

Solved: at some point the mount lost the serverino Samba mount option. I was never explicitly supplying that option, but it was being set by default (confirmed by checking the /proc/mounts options of another CIFS mount with identical options). I added serverino explicitly to the mount options, re-mounted, and now hard links are working again. I can't explain why that option stopped working in the first place, but at least it's fixed now. 🙌

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .