Backing up your NAS with Dropbox - Non Native

Posted by Adrian Duke on 01 February 2012

So, we had a problem in the office the other day... We bought a new Synology DS1511+ (x86 - Intel Atom) to replace our old *nix NAS, which had dropboxd running on it. I thought I would have a crack at getting dropboxd compiled on the DS1511+, after all it was an x86 architecture and it had ipkg to install make utils... But to no avail.

The problem is that the version of GLIBC that comes with DSM 3.2 is 2.3.6 and the version of GLIBC that dropboxd wants is 2.4.*... Damn. I also tried a precompiled binary, but that was a whole other can of worms, again it boiled down to features that are present in GLIBC 2.4 but not 2.3. Unfortunately, I don't possess the skills for cross-compiling nor have I the time, if anyone else fancies the challenge go ahead and let me know how you get on!

So the alternatives were to send back the shiny new NAS OR find another way. We chose the latter. In this blog post I will document an alternative to native dropboxd for NAS backup... Yes we could use S3 backup, but that's already baked into DSM and no fun ;) plus we wanted dropbox specifically.

Goal:

Have the NAS and dropbox synced together. We will use the spare computer to mount shares from the NAS and use its architecture to run the dropbox client.

Requirements:

  • NAS
  • Spare computer (*nix/Mac)... We will use Mac OS X 10.6+ for the rest of this tutorial (with hints for *nix).
  • Native Dropbox client for OS of spare computer
  • Dropbox account
  • Network connection between the NAS and spare machine

Step 1 - Pre Setup

If you haven't done so already, enable network shares for the relevant folders on your NAS that you want sync'd and add a user than can read/write them. If your using a Mac enable AFP shares or SMB (samba) and if your using *nix go for NFS or SMB. In the case of Synology it is as simple as using the web interface.

Step 2 - Setup

Setup a folder on your spare computer that will hold the dropbox folder. You can use the default location but in our case we didn't want users using the mounted locations.

$ sudo mkdir /share

// Change owner ship of /share folder so we can write to it
$ sudo chown -R <local username>:wheel /share

Step 3 - Install Dropbox

Now it's time to install your dropbox and point it towards / share (Advanced setup). It will create a folder called 'Dropbox' inside share and will probably try and start syncing... At this point pause the sync.

Step 4 - Mounting

Now we are going to use automount to mount our folders from the NAS. If you're using *nix you can use your fstab for this part (google for 'mounting smb/nfs shares with fstab').

$ sudo vi /etc/auto_master

You'll see something along the lines of this:

#
# Automounter master map
#
+auto_master	# Use directory service
/net			-hosts		-nobrowse,hidefromfinder,nosuid
/home		auto_home	-nobrowse,hidefromfinder
/Network/Servers	-fstab
/-			-static

Add the following line to the bottom:

/share/Dropbox          auto_dropbox

This tells the automount service that you want to use a sub-mount map to define your mounts, and that sub-mount map is relative to '/share/Dropbox'. Your full 'auto_master' file should look like this:

#
# Automounter master map
#
+auto_master	# Use directory service
/net			-hosts		-nobrowse,hidefromfinder,nosuid
/home		auto_home	-nobrowse,hidefromfinder
/Network/Servers	-fstab
/-			-static
/share/Dropbox     auto_dropbox

Now save and exit. Run the next command to create the 'auto_dropbox' sub-map and edit it

$ sudo vi /etc/auto_dropbox

Now you will want to fill this file with the directories you want from your NAS, here is an example based from our own

[foldername]    -fstype=[sharefstype]    [sharetype]://[username]:[password]@[NAS hostname / IP]/[foldername shared on NAS]
clients             -fstype=afp    afp://auser:arealpassword@green.local/clients

If you wanted to use SMB you can replace '-fstype=afp' with '-fstype=smbfs' and use 'smb://' instead of 'afp://'. Also note that [foldername] is relative to '/share/Dropbox'.

Now just run the following commands to re-mount:

$ sudo automount -vc

Step 5 - Finishing Up

That's about it. Now your shares are mounted you can resume the dropbox sync and it will happily plod along backing up your NAS.

Conclusion

While not as graceful / efficient as having dropboxd running directly on the NAS, this is definitely a viable solution and it works. This will be especially helpful for anyone with an ARM based NAS as dropbox I believe said they won't be supporting it anytime soon.

If you're having problems with this, please leave your comments below and we will do our best to help you.

Comments

No one has commented on this page yet.

Post your comment