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












3















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?










share|improve this question


















  • 1





    Try ls -Ld /home/username/Desktop/file. If it says ls: cannot access /home/username/Desktop/file: No such file or directory, the link is broken. Otherwise I think the desktop is not updating when the drive is mounted. Try clicking the desktop then pressing F5 or Ctrl+R to refresh it, or try logging out and back in.

    – wjandrea
    Jan 19 at 23:17











  • @wjandrea Thanks, you were right. F5 worked. Is there a way to have the desktop refresh automatically after the drive is mounted?

    – ticotexas
    Jan 20 at 18:07






  • 1





    My research didn't turn up much. My only recommendation is to edit the question title to clarify the issue, cause it seems like the symlink is actually surviving, but the desktop thinks its broken, maybe because the mount is slower than the desktop on startup.

    – wjandrea
    Jan 21 at 17:03











  • @wjandrea as requested ;-)

    – Rinzwind
    Jan 21 at 17:36






  • 1





    refreshing desktop: askubuntu.com/questions/518971/… you need to kill nautilus.

    – Rinzwind
    Jan 21 at 17:43
















3















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?










share|improve this question


















  • 1





    Try ls -Ld /home/username/Desktop/file. If it says ls: cannot access /home/username/Desktop/file: No such file or directory, the link is broken. Otherwise I think the desktop is not updating when the drive is mounted. Try clicking the desktop then pressing F5 or Ctrl+R to refresh it, or try logging out and back in.

    – wjandrea
    Jan 19 at 23:17











  • @wjandrea Thanks, you were right. F5 worked. Is there a way to have the desktop refresh automatically after the drive is mounted?

    – ticotexas
    Jan 20 at 18:07






  • 1





    My research didn't turn up much. My only recommendation is to edit the question title to clarify the issue, cause it seems like the symlink is actually surviving, but the desktop thinks its broken, maybe because the mount is slower than the desktop on startup.

    – wjandrea
    Jan 21 at 17:03











  • @wjandrea as requested ;-)

    – Rinzwind
    Jan 21 at 17:36






  • 1





    refreshing desktop: askubuntu.com/questions/518971/… you need to kill nautilus.

    – Rinzwind
    Jan 21 at 17:43














3












3








3


0






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?










share|improve this question














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?







fstab nfs symbolic-link






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 19 at 22:59









ticotexasticotexas

385




385








  • 1





    Try ls -Ld /home/username/Desktop/file. If it says ls: cannot access /home/username/Desktop/file: No such file or directory, the link is broken. Otherwise I think the desktop is not updating when the drive is mounted. Try clicking the desktop then pressing F5 or Ctrl+R to refresh it, or try logging out and back in.

    – wjandrea
    Jan 19 at 23:17











  • @wjandrea Thanks, you were right. F5 worked. Is there a way to have the desktop refresh automatically after the drive is mounted?

    – ticotexas
    Jan 20 at 18:07






  • 1





    My research didn't turn up much. My only recommendation is to edit the question title to clarify the issue, cause it seems like the symlink is actually surviving, but the desktop thinks its broken, maybe because the mount is slower than the desktop on startup.

    – wjandrea
    Jan 21 at 17:03











  • @wjandrea as requested ;-)

    – Rinzwind
    Jan 21 at 17:36






  • 1





    refreshing desktop: askubuntu.com/questions/518971/… you need to kill nautilus.

    – Rinzwind
    Jan 21 at 17:43














  • 1





    Try ls -Ld /home/username/Desktop/file. If it says ls: cannot access /home/username/Desktop/file: No such file or directory, the link is broken. Otherwise I think the desktop is not updating when the drive is mounted. Try clicking the desktop then pressing F5 or Ctrl+R to refresh it, or try logging out and back in.

    – wjandrea
    Jan 19 at 23:17











  • @wjandrea Thanks, you were right. F5 worked. Is there a way to have the desktop refresh automatically after the drive is mounted?

    – ticotexas
    Jan 20 at 18:07






  • 1





    My research didn't turn up much. My only recommendation is to edit the question title to clarify the issue, cause it seems like the symlink is actually surviving, but the desktop thinks its broken, maybe because the mount is slower than the desktop on startup.

    – wjandrea
    Jan 21 at 17:03











  • @wjandrea as requested ;-)

    – Rinzwind
    Jan 21 at 17:36






  • 1





    refreshing desktop: askubuntu.com/questions/518971/… you need to kill nautilus.

    – Rinzwind
    Jan 21 at 17:43








1




1





Try ls -Ld /home/username/Desktop/file. If it says ls: cannot access /home/username/Desktop/file: No such file or directory, the link is broken. Otherwise I think the desktop is not updating when the drive is mounted. Try clicking the desktop then pressing F5 or Ctrl+R to refresh it, or try logging out and back in.

– wjandrea
Jan 19 at 23:17





Try ls -Ld /home/username/Desktop/file. If it says ls: cannot access /home/username/Desktop/file: No such file or directory, the link is broken. Otherwise I think the desktop is not updating when the drive is mounted. Try clicking the desktop then pressing F5 or Ctrl+R to refresh it, or try logging out and back in.

– wjandrea
Jan 19 at 23:17













@wjandrea Thanks, you were right. F5 worked. Is there a way to have the desktop refresh automatically after the drive is mounted?

– ticotexas
Jan 20 at 18:07





@wjandrea Thanks, you were right. F5 worked. Is there a way to have the desktop refresh automatically after the drive is mounted?

– ticotexas
Jan 20 at 18:07




1




1





My research didn't turn up much. My only recommendation is to edit the question title to clarify the issue, cause it seems like the symlink is actually surviving, but the desktop thinks its broken, maybe because the mount is slower than the desktop on startup.

– wjandrea
Jan 21 at 17:03





My research didn't turn up much. My only recommendation is to edit the question title to clarify the issue, cause it seems like the symlink is actually surviving, but the desktop thinks its broken, maybe because the mount is slower than the desktop on startup.

– wjandrea
Jan 21 at 17:03













@wjandrea as requested ;-)

– Rinzwind
Jan 21 at 17:36





@wjandrea as requested ;-)

– Rinzwind
Jan 21 at 17:36




1




1





refreshing desktop: askubuntu.com/questions/518971/… you need to kill nautilus.

– Rinzwind
Jan 21 at 17:43





refreshing desktop: askubuntu.com/questions/518971/… you need to kill nautilus.

– Rinzwind
Jan 21 at 17:43










1 Answer
1






active

oldest

votes


















1















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.



  • Long explantion on Unix.stackexchange






share|improve this answer
























  • Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

    – ticotexas
    Jan 22 at 1:30











  • You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

    – Rinzwind
    Jan 22 at 7:51











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1111233%2fhow-do-you-create-a-symlink-to-a-file-on-a-mounted-disk-that-survives-reboot%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1















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.



  • Long explantion on Unix.stackexchange






share|improve this answer
























  • Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

    – ticotexas
    Jan 22 at 1:30











  • You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

    – Rinzwind
    Jan 22 at 7:51
















1















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.



  • Long explantion on Unix.stackexchange






share|improve this answer
























  • Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

    – ticotexas
    Jan 22 at 1:30











  • You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

    – Rinzwind
    Jan 22 at 7:51














1












1








1








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.



  • Long explantion on Unix.stackexchange






share|improve this 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.



  • Long explantion on Unix.stackexchange







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 21 at 17:34









RinzwindRinzwind

206k28394526




206k28394526













  • Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

    – ticotexas
    Jan 22 at 1:30











  • You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

    – Rinzwind
    Jan 22 at 7:51



















  • Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

    – ticotexas
    Jan 22 at 1:30











  • You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

    – Rinzwind
    Jan 22 at 7:51

















Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

– ticotexas
Jan 22 at 1:30





Are you suggesting to bind the network drive already mounted to a duplicate/redundant location and then symlinking the file there? Wouldn't that be the same as what I'm doing? I don't think you can bind a file, can you?

– ticotexas
Jan 22 at 1:30













You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

– Rinzwind
Jan 22 at 7:51





You bind a directory not a file. "and then symlinking the file there" No symlinking needed; you use the "newdir" as the location you want to see on the desktop.So you get an directory icon on your desktop.

– Rinzwind
Jan 22 at 7:51


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1111233%2fhow-do-you-create-a-symlink-to-a-file-on-a-mounted-disk-that-survives-reboot%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕