- 1 Introduction
- 2 I am still getting the error
- 3 Remove the awkward entry from nautilus/nemo
- 4 Prevent accidental ejecting through nautilus/nemo
- 5 A word on home folder encryption
Dropbox has recently announced that they will be dropping support for all file systems that do not mount as plain ext4, that includes btrfs, zfs, xfs and ecryptfs (the home encryption shipped with many popular Linux distributions). Poop-emoticon! Luckily, it seems like ext4 on top of cryptsetup/LUKS is not affected by this awful business decision.
Unfortunately, many users are locked in with Dropbox for various reasons.
- Using an app, that only synchronizes through Dropbox via their api
- Sharing with peers that will only use Dropbox
- Paid annually and does not want to forfeit the storage
- Working for a company or organization that has long approval processes
Luckily, for the time being there is a workaround, as shown by this step-by-step guide. Proceed with caution and have backups. One wrong step and you might find yourself with an empty Dropbox. If you use home folder encryption, please read this before continuing.
Regardless of your success with this workaround, you might want to check out alternatives like pCloud (Disclaimer: Affiliate Link. One month free through this link)
We will use a technology called loopback mounting, where you can treat a file like a block device and mount it to a specific location. It has usually been used in the past to mount .iso files, but it is perfectly capable of mounting any file system your Linux is capable of mounting. You can read more about it here.
Kill it with fire!
First, quit Dropbox. We hate what they did, so we are killing the poop out of it. Open a terminal, and type:
~ $ killall dropbox
Use ps x to verify dropbox is not running anymore.
(not really a backup, but we make way)
~ $ mv Dropbox Dropbox.bak ~ $ mkdir Dropbox
Verify the contents of Dropbox.bak! A backup is only a backup if you can restore your data.
Create your loopback file
I am sizing it 150% of my Dropbox allowance, 3072MB, since I am only using the free version. This might be tougher if you are using a paid version with lots of potential storage. It is possible to expand this file later, a Google search for expand ext4 loopback should yield viable results.
~ $ dd if=/dev/zero of=~/.dropbox/storage bs=1M count=3072
create an ext4 filesystem
Become root, which is usually done by issuing sudo su or su and enter the appropriate password. It should be obvious that you replace <username> by your actual username from this moment on.
optional: prevent writes when not mounted
As Jason Lewis pointed out in the comments, you can prevent accidental writes to /home/<user>/Dropbox, when the loopback device is not mounted. This is completely optional, but probably a smart thing to do. To set the “immutable”-bit, still as root, do:
chattr +i /home/<user>/Dropbox
To mount the filesystem, add this line to your /etc/fstab.
/home/<username>/.dropbox/storage /home/<username>/Dropbox ext4 defaults,user_xattr,loop 0 0
and mount with:
~ # mount /home/<username>/Dropbox/
The folder might belong root, we can fix that by executing:
~ # chown -R <username>:<groupname> /home/<username>/Dropbox ~ # exit
Please note, that <groupname> is usually your username, but it might differ. To find out what to put there, simply execute ls -l in your homefolder and examine the results.
Restore your Dropbox contents
~ $ cp -a Dropbox.bak/* Dropbox/
You’re all done, you can now restart your dropbox client. Keep your Dropbox.bak folder and reboot. Check, if everything works as expected before you get rid of your file. Luckily, even if you lose them, you can restore them in your Dropbox account as a last resort. Let me know in the comments below, if it worked.
I am still getting the error
It might be that even after applying this workaround, you still get the message, that your filesystem won’t be supported. If you have set up your loopback device properly, you can safely ignore it.
Remove the awkward entry from nautilus/nemo
Because of how we implemented this workaround, new devices called Filesystem xxGB might show up in the file managers. We don’t want these, at best, we want our workaround to be as transparent as possible. You can remove it by creating a udev rule. I have tested that on Gentoo Linux, details might be different in your distribution.
Find out the UUID for your loopback image:
# blkid /dev/loop0: UUID="e0036b9d-7f49-473e-9296-47c8b0e273e1" TYPE="ext4"
And reload the rules
udevadm control --reload-rules && udevadm trigger
The entry should be gone and you should now only see a mounted “Dropbox” device.
Prevent accidental ejecting through nautilus/nemo
On my desktop, I get a little eject-symbol next to my drive entry in nemo, clicking it will immediately remove the loopback device and Dropbox will think you delete ALL THE FILES. To prevent that, please remove this line from any file in /etc/polkit-1/rules.d/
action.id == "org.freedesktop.udisks2.filesystem-unmount-others" ||
Depending on your Linux distribution and security settings, it might not be necessary to do this. To test if you can accidentally eject with the arrow, kill Dropbox first!
A word on home folder encryption
Technically, it is possible to create the dropbox filesystem image within your home folder, keeping it encrypted whenever your device is powered off (basically the same level of security as you get from ecryptfs). The problem however is, that by the time /etc/fstab gets parsed on boot time, your home folder is not unlocked, therefore it won’t be able to find the file and fail the mount. In that case, you will have to add noauto,user to your mount options (after loop in /etc/fstab). That way, the filesystem is not mounted automatically on boot. You then have to remove Dropbox from your autostart and create a script, that is executed on login instead, which executes
mount /home/<username>/Dropbox/ dropbox &
to first mount and then start the daemon. In cinnamon, you could also set a 30s start delay for dropbox and add a script that only does the mounting without a start delay. The ways to get this working are limitless and may depend on what distribution and windowmanager you use, so in case you need help, find it within your distribution’s community. Good luck!