Linux: Sharing a Dropbox folder over the LAN with NFS

28 March 2021

Let’s say you are running low on disk space on a particular machine and so rather than running Dropbox on each computer on the LAN, you decide to serve it up from one machine.

It turns out that if you just use Dropbox in your $HOME and try to symlink to a folder on NFS this does not work — in other words, you can’t just use a network drive as storage for Dropbox.

My understanding is that this is likely to be as a result of Dropbox relying syscalls for the platforms it supports (e.g. linux) which are only available with local filesystems. So wherever the Dropbox daemon is running will require access to a local volume. In addition, it needs to be running a supported platform (e.g. linux). It can still be shared over the network with NFS, however. Set out below is how to do this; the machine I used is running Ubuntu 20.04.

This assumes a linux machine laying around and a spare volume — I used a fresh USB SSD device and mounted in $HOME/Dropbox.

Once that’s done:

# Get the linux server 64-bit version
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
# Run it
~/.dropbox-dist/dropboxd
# Note you you will need to go to the URL in the output to associate/permission with your existign Dropbox account

Leave that running and now download and run the client:

# Get the client
wget -O dropbox.py "https://www.dropbox.com/download?dl=packages/dropbox.py"
chmod a+x dropbox.py

# This will tell you what it's upto e.g.
# Syncing 7,080 files • 2+ days
# Downloading 7,080 files (146.7 KB/sec, 2+ days)
./dropbox.py status

And you’re off to the races. It seems to do the small files first so it will be slow at first but get faster.

Now to share over the network with NFS; installing the NFS server:

sudo apt install nfs-kernel-server

And adding the below to the NFS exports file:

/home/username/Dropbox *(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000,insecure)

(where /home/username is the same as $HOME above.)

sudo systemctl restart nfs-kernel-server

After which you should be able to then mount this folder on another machine using NFS.

And if you then need to remove locally there are instructions for how to do that see the Dropbox website here