3

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 05:40
  • That command is missing a target. – Rinzwind Jul 21 '15 at 06: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 06: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 – FelixJN Jul 21 '15 at 07: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-Katz Jul 21 '15 at 14:56
  • I like the idea of an auto-script, but I'm not sure it would work as there is never any action for it to detect, unless finding the second hard drive at start up counts. – N. Overton-Katz Jul 21 '15 at 15:06

1 Answers1

4

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.

Pilot6
  • 90,100
  • 91
  • 213
  • 324
  • That would appear to be the problem, thank you! I found this link to be more helpful however https://help.ubuntu.com/community/AutomaticallyMountPartitions#Systemwide_Mounts – N. Overton-Katz Jul 22 '15 at 02: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 09 '16 at 17:25
  • There's a nice gui method to sort that problem here https://askubuntu.com/questions/154180/how-to-mount-a-new-drive-on-startup/588034#588034 – Mr Purple Nov 29 '17 at 04:50