The Guru College
Dropbox and ZFS
It may be gathered that I’m a fan of Sun’s filesystem ZFS, and that I really like DropBox. I’d love for the two to go hand in hand, but according to the forums, the Dropbox team hasn’t found a suitable Solaris interface for file updates – like the ones provided by fseventsd in OSX or inotify in Linux. I think with the snapshots available to ZFS, my one real concern of using Dropbox would go away: if a file is deleted from the Dropbox folder, it’s deleted from all clients. Sure there’s a version on the web that may be restorable, but if Dropbox doesn’t hang around long term or if there are network problems in the cloud, you can’t get stuff back. I think I’ve found a way to do all of this, and it’s really pretty simple.
All of the following assumes you have a file server running Solaris and ZFS, as well as a Mac or a Linux client that is associated with Dropbox. It also assumes your LAN connection is secure. (Yes, with NFS4 it becomes easier to set up IPSEC, but that’s an exercise left to the reader.) It also assumes you are either running a current build of Nevada or you have installed the zfs-auto-snapshot service. Here’s what I suggest you do:
- solaris# zfs create -o sharenfw=rw tank/dropbox_client_sync
- solaris# zfs set mountpoint=/dropbox_client_sync tank/dropbox_client_sync
- osx-client# mkdir /dropbox_client_sync
- osx-client# mount -t nfs _fileserverip:/dropbox_client_sync /dropbox_client_sync
- solaris# zfs set com.sun:auto-snapshot:hourly=true tank/dropbox_client_sync
- solaris# zfs set com.sun:auto-snapshot:daily=true tank/dropbox_client_sync
- osx-client# rsync -a -c /Users/username/Dropbox /dropbox_client_sync
All that’s left is to write a crontab entry or a launchd job for osx-client to rsync a few minutes after the hour, every hour. This way, the Solaris server will take a snapshot just before every rsync event, and you’ll have a safe copy of all your data – including major revisions – in case of disaster.
Of course, this doesn’t allow for the fine grained file recovery that the Dropbox web interface has – if you save 10 copies of a file between 9 AM and 10 AM, you only get one of those back on the ZFS side. However, this is a step in the right direction to make sure you have control of your data (and backups of your data) in multiple places!