Of course I have a backup!

Random blobs of wisdom about software development

Use Dropbox on any filesystem

Monday, 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.

  1. Close dropbox
  2. Determine the size of your Dropbox folder with du -hs ~/Dropbox
  3. truncate --size 5G dropbox.img # put whatever the size is here
  4. If you are using a CoW filesystem, disable CoW for the image with sudo chattr +C dropbox.img
  5. mkfs.ext4 -F dropbox.img
  6. mv Dropbox Dropbox.old
  7. sudo mount -o loop,rw dropbox.img ~/Dropbox
  8. sudo chown youruser:youruser ~/Dropbox
  9. cp -r Dropbox.old/* Dropbox/
  10. 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 (pay attention to the capital Dropbox):

/etc/systemd/system/home-youruser-Dropbox.mount
[Mount]
What=/home/youruser/dropbox.img
Where=/home/youruser/Dropbox
Type=ext4
Options=loop,rw
/etc/systemd/system/home-youruser-Dropbox.automount
[Install]
WantedBy=multi-user.target

[Unit]
Description=Automount Dropbox

[Automount]
Where=/home/youruser/Dropbox

[Install]
WantedBy=multi-user.target

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.

This was written by Norbert Kéri, posted on Monday, September 17, 2018, at 22:11

Tagged as:
Gianpaolo Racca wrote
Just a little note: Dropbox in systemd filename must be in uppercase like the directory used to mount the dropbox.img file.
Otherwise you get an error like:
home-gianpaolo-dropbox.automount: Where= setting doesn't match unit name. Refusing.
Thanks anyway for this wonderful howto.

2018-11-01 08:52:48

Post a comment

Providing your email is optional, it is never published or shared, it is only used for auto approval purposes. If you already have at least 1 approved comment(s) tied to your email, you don't have to wait for moderation, otherwise the author must approve your comment.

Please solve this totally random captcha