Use Dropbox on any filesystemMonday, September 17, 2018
If you have been using Dropbox on a filesystem other than ext4, you have been probably getting annoyed by the following warning, in the past 2 months:
Move Dropbox location. Dropbox will stop syncing in November.
According to Dropbox, this is intended, and their official response is:
Hi everyone, on Nov. 7, 2018, we’re ending support for Dropbox syncing to drives with certain uncommon file systems. The supported file systems are NTFS for Windows, HFS+ or APFS for Mac, and Ext4 for Linux. We’ve updated our desktop requirements accordingly here. A supported file system is required as Dropbox relies on extended attributes (X-attrs) to identify files in the Dropbox folder and keep them in sync. We will keep supporting only the most common file systems that support X-attrs, so we can ensure stability and a consistent experience.
Which is the corporate bullshit version of saying "sorry we run into some obscure problems with some filesystems, so we only have the capacity to support one for now", but that is a big marketing and sales no-no, so instead they sell it as a "consistent experience" and "stability", and some random bit about xattrs, which every filesystem supports. Here's a workaround.
First of all, I'd advise everyone to take a look at syncthing, and see if it solves your needs, because it's a quite good alternative. I'm also a bit curious about the legal side of this, could existing paying users now cancel their annual payment, because Dropbox changed their agreement?
With that said, the workaround is to create an ext4 filesystem in a file, mount that as a loopback, move the dropbox folder there, and have systemd automount it on first access. This let's you basically run Dropbox irregardless of what your host filesystem is, and due to the systemd automount, it's absolutely automated and pain free.
- Close dropbox
- Determine the size of your Dropbox folder with
du -hs ~/Dropbox
- truncate --size 5G dropbox.img # put whatever the size is here
- If you are using a CoW filesystem, disable CoW for the image with
sudo chattr +C dropbox.img
- mkfs.ext4 -F dropbox.img
- mv Dropbox Dropbox.old
- sudo mount -o loop,rw dropbox.img ~/Dropbox
- sudo chown youruser:youruser ~/Dropbox
- cp -r Dropbox.old/* Dropbox/
- sudo umount ~/Dropbox
Create two files, and place them under
/etc/systemd/system/. The filenames have to reflect the mount path, this is in the systemd spec:
Reload systemd with
systemctl daemon-reload, then start the automount with
sudo systemctl start home-youruser-dropbox.automount. Then if you do a
ls ~/Dropbox, you should see the contents of your Dropbox folder, because systemd automounts it. Do not continue until you get this working.
Enable the automount, so it gets started at system boot with
sudo systemctl enable home-youruser-dropbox.automount, and start dropbox again. Everything should be working fine.
There is probably a way to do this with a systemd user file (instead of a system one), this is left as an exercise to the reader.
One thing to note with this, is that if your filesystem has snapshots, you lose the "incrementality" of snapshotting the Dropbox folder, since now it's a separate mount, it will not be included in the snapshot. Since Dropbox has its own backup mechanism anyway, and the image file itself will be present in your snapshots, it might not be a big problem.