I have been working on setting up some symbolic links so that I can easily access directories and files on another internal hard drive. When I create the links they work well, but every time that I restart the links are lost. Is there a better way to use links or refresh them?

I am currently creating links like this

ln -s /media/UserName/DiskName

I am running ubuntu 15.04 64-bit

  • 1
    Two quick questions: Are the links disappearing or just broken? What version of Ubuntu are you running? – Ian Jul 21 '15 at 5:40
  • That command is missing a target. – Rinzwind Jul 21 '15 at 6:44
  • @Rinzwind no need for a target if you want the link to be named the same as the source in the current directory. – mgor Jul 21 '15 at 6:52
  • Is it an external drive? If so you can use udev-rules to auto-run a script to create the links when the drive is plugged in. See here and here – Fiximan Jul 21 '15 at 7:36
  • To clear it up the links are still there, but broken. The drive I am trying to access is a second hard drive on my machine, so ubuntu is on drive A and I have the symbolic link to drive B. – N. Overton Jul 21 '15 at 14:56

The reason is quite clear. You did not set mounting rules for this disk in /etc/fstab/.

When system starts, the disk is not mounted.

Just add a line to /etc/fstab for a permanent rule and the problem will be solved.

This is a guide.

  • That would appear to be the problem, thank you! I found this link to be more helpful however help.ubuntu.com/community/… – N. Overton Jul 22 '15 at 2:33
  • See my answer for a way that doesn't require you to compose a /etc/fstab entry. I will also add that the bug is in nautilus, since after you log in, there's a perfectly valid mounted partition where the symlink expects to find it, yet the link fails. – Stefan Monov Dec 9 '16 at 17:25
  • There's a nice gui method to sort that problem here askubuntu.com/questions/154180/… – Mr Purple Nov 29 '17 at 4:50

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.