Recently, I noticed that my hard drive usage had suddenly doubled. Using OmniDiskSweeper as a tool to quickly visualize my folder and file sizes, I discovered that my Dropbox cache file (in /Users/<username>/.dropbox/cache) had grown to 26GB! There seem to be some issues with cache management in Dropbox, but my usage also probably didn’t fit a normal use case. What behavior of mine caused this, and what did I do about it?
I write code on 2 different machines: my (aging) MacBook Pro and a 24″ iMac. Looking back, I should have replaced the MacBook and added a 24″ monitor instead of buying the iMac, but that’s hindsight…
Anyway, I was actually keeping certain Ruby on Rails projects in git in folders in Dropbox. Yes, I know this is slightly redundant when using a version control system, and I caught some flak for this from a colleague. But the convenience was amazing. I often get up from my iMac mid-coding session and end up plopping down someplace else with the laptop and resuming. It is so nice not to have to commit, push, and pull every time this happens. In fact, sometimes I don’t even completely plan it; I’ll leave the house for an errand, and end up staying out and coding from a coffee shop. Since I rarely leave home without my laptop (which I’m beginning to think is a character flaw) this works well for me.
Syncing a git repo through Dropbox
Up until now, I’ve had very few problems syncing a git repository through Dropbox. The only real issue I ever encountered was that the file permissions would change on executable files. Newly created files with 755 permissions would sometimes turn to 644 when synced to the other machine. Doing a fresh git checkout on just these files would restore the permissions and they would stay correct. (I never bothered trying to solve this problem permanently).
Once, I actually ended up with a conflict in the git index, but it was easily resolved since Dropbox doesn’t blow away any files in this case (it just appends the name with “(conflicted copy)”.
The other day, I begin using autospec combined with spork (highly recommended by the way) in my testing. Something about this process generates lots of log files (temporary or otherwise, I haven’t checked). While this was going on, the Dropbox cache files on the other computer where silently growing HUGE.
By the time I realized it, the cache files for a 4 day period had grown in size from something normal to 26GB!!!
I probably should take the time to figure out exactly what’s going on, maybe even give the Dropbox guys some pointers on how to replicate this situation. I still might – I still love Dropbox and it has its place in my computing.
But for now, I’m going to take my git repos out my Dropbox. I was feeling guilty about it anway – it felt like I was doing something dirty – so this was the straw that broke the camel’s back.
As for reclaiming the space? Its safe to delete your Dropbox cache files. Just shut down Dropbox, delete the cache files (individual folders or the while ~/.dropbox/cache folder) and then restart Dropbox.