As of mid-2019, Dropbox announced that they no longer support symlinks that point outside of the main Dropbox folder. In this tutorial, we show a workaround on Linux that enables us to store in Dropbox any file, even if it is not located within the main Dropbox folder.
Imagine that you have a bunch of files that you would like to synchronize across your devices, but they are stored outside of your Dropbox folder. For example, assume that your main Dropbox folder is located at ~/Dropbox but your documents live in the ~/Documents folder. Up to recently, you had the option to add those files in Dropbox without physically moving them by creating a symlink:
ln -s ~/Documents ~/Dropbox/Documents
Unfortunately this feature got deprecated by Dropbox. Every folder/file that was a symlink is now copied and the “(Symlink Backup Copy)” is appended to it. This means that any changes you make to your original external folders will no longer be visible to Dropbox.
Thankfully there is a quick and easy solution to work around the limitation on Linux. Below I explain how this can be achieved on Ubuntu, but the process should be similar to other Linux distributions.
To achieve the same effect, we are going to use “bind mount”. A bind mount enables us to create an alternative view of the original directory tree in a new location. Any modification on one side is immediately reflected on the other, effectively allowing us to share the same data.
To create a bind mount you can use the following commands:
# Create mounting point in Dropbox folder mkdir -p ~/Dropbox/Documents # Link the external folder in Dropbox sudo mount --bind ~/Documents ~/Dropbox/Documents
That’s it! Dropbox should be able to start synchronizing the data. Unfortunately the mount command does not persist between restarts. To make the change permanent we need to modify the /etc/fstab file by appending:
WARNING: Editing your fstab file incorrectly can render your computer unbootable. It’s straightforward to recover from this problem but before editing the file, you are advised to do some reading.
# Add one line for every external Dropbox folder /home/YOUR_USERNAME_HERE/Documents /home/YOUR_USERNAME_HERE/Dropbox/Documents none defaults,bind,x-gvfs-hide 0 0
Note that adding the x-gvfs-hide option will allow make Nautilus file manager to hide the mounting points.
I hope that’s helpful. Happy Dropboxing. 🙂
Thanks! That is very helpful
Hello, does this work if my data is stored outside my home directory? I keep data on a RAID array multi-disk setup.