Installing DropBox on ZFS

While I already wrote about expanding DropBox's Ext4 volume on ZFS, I never actually wrote how to create one in the first place. I guess it's time to fix that injustice.

First you need to create a volume of sufficient size. While you can just make it as big as your Dropbox allowance is, I would advise going with at least double of that. Not only this helps if you are doing ZFS snapshots (remember it's copy-on-write) but it also helps if you are moving files around as Dropbox fully releases space only once the new files are created.

Whatever you decide, you need to create a volume and format it:

Terminal
sudo zfs create -V 12G pool/dropbox
sudo mkfs.ext4 /dev/zvol/pool/dropbox

Once volume is created, mounting the newly created volume within our user directory is in order:

Terminal
mkdir /home/user/Dropbox
sudo mount /dev/zvol/pool/dropbox /home/user/Dropbox
sudo chown -R user:user Dropbox

Of course, to retain it between reboots one should add it to fstab:

Terminal
echo "/dev/zvol/pool/dropbox /home/user/Dropbox ext4 defaults,_netdev 0 0" | sudo tee -a /etc/fstab

Do note the _netdev part as it ensures dropbox volume is mounted way after ZFS has already done so. Without it you might have a race condition and volume mounting might prevent subpools to be mounted under the same path.

Finally you can install Dropbox as you usually would. While it will complain about directory already being present, you can simply cancel directory selection and it will start syncing regardless.

Congratulations, your Dropbox is now on ZFS.

Leave a Reply

Your email address will not be published. Required fields are marked *