jax7121
Posts: 7
Joined: Wed Dec 19, 2018 10:03 pm

Create symbolic link in a mounted Nas

Wed Aug 07, 2019 9:09 am

I hope you can help me solve my problem. My Raspberry mounts a NAS in the path /home/pi/NAS at startup. The /etc/fstab file is configured as follows:

Code: Select all

//192.168.1.2/share /home/pi/NAS cifs username=user,password=password,vers=1.0,sec=ntlm,file_mode=0777,dir_mode=0777,uid=pi,gid=pi,forceuid,forcegid,_netdev,x-systemd.automount 0 0
To avoid duplicating files, I decided to create symbolic links with the command:

Code: Select all

ln -s /home/pi/NAS/Folder1/file.mp4 /home/pi/NAS/Folder2/file.mp4
but I get the error message:

Code: Select all

ln: creation of the symbolic link '/home/pi/NAS/Folder2/file.mp4' failed: It is not a directory
However, the same command works locally by running:

Code: Select all

ln -s /home/pi/Folder1/file.mp4 /home/pi/Folder2/file.mp4
work perfectly!

Where am I wrong? Can there be an error in the /etc/fstab file?
Thanks in advance

User avatar
topguy
Posts: 6491
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Create symbolic link in a mounted Nas

Wed Aug 07, 2019 1:08 pm

Symbolic links are kinda special feature and does not automatically work across mounted filesystems, I was surprised it could be made to work at all..

https://superuser.com/questions/1337257 ... amba-share

User avatar
thagrol
Posts: 3077
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Create symbolic link in a mounted Nas

Fri Aug 09, 2019 8:50 pm

The underlying filesystem has to support symlinks for them to work.

Linux/Unix files systems do (ext ... ext4, etc) windows file systems don't. Samba shares will complicate things and may not allow them to be created on remote shares (but may handle them correctly if created directly on the server). Given that samba/cifs originated in the windows world I'd not expect the smb layer to support symlinks.

@topguy: symlinks will work across mount points and/or file systems but the filesystem they're being created on must support them. The filesystem containing the target of the link doesn't have to.
Arguing with strangers on the internet since 1993.

Return to “Beginners”