Ubuntu – How do you create a symlink to a file on a mounted disk that survives reboot

fstabnfssymbolic-link

On my network, I have a disk on my other computer running Ubuntu (both computers with 18.10) mounted to /home/username/Storage via nfs in fstab. That fstab line looks like,

192.168.2.33:/otherhome/otherusername /home/username/Storage nfs rsize=8192,wsize=8192,timeo=14,intr

On that other computer, I have a file that I want to symlink so I can open it from an icon on my current desktop. So I do ln -s /home/username/Storage/file /home/username/Desktop. It works fine until I reboot. Then it says the link is broken, although it lists the correct target if I right-click and look at the properties.

Is there a way to keep a symlink to a file on a mounted network disk after reboot? Am I doing it wrong?

Best Answer

Is there a way to keep a symlink to a file on a mounted network disk after reboot? Am I doing it wrong?

Nope. You can re-create the link on reboot if you want. But the more logical method would be to use the bind option from mount. From man page:

Bind mount operation
   Remount part of the file hierarchy somewhere else.  The call is:

          mount --bind olddir newdir

   or by using this fstab entry:

          /olddir /newdir none bind

   After this call the same contents are accessible in two places.