Skip to content

Instantly share code, notes, and snippets.

@kbumsik
Last active October 7, 2023 01:55
Show Gist options
  • Save kbumsik/b7cc243e297a3a66837151024049f43c to your computer and use it in GitHub Desktop.
Save kbumsik/b7cc243e297a3a66837151024049f43c to your computer and use it in GitHub Desktop.
Native Dropbox client for FreeNAS SCALE

Native Dropbox client service for TrueNAS SCALE

Although FreeNAS (TrueNAS) does support Dropbox backup, it is not the official Dropbox client that offers native and almost-real-time syncing.

Their new project, TrueNAS SCALE, is the Linux version of FreeNAS. Since it is Linux Debian OS rather than FreeBSD, you now can run any Linux programs like the official Dropbox client.

This guide is intended to learn how to run the official headless Dropbox daemon on bootup.

Install Dropbox daemon

A non-root user with a home directory in a ZFS mount is HIGHLY recommended (e.g. a non-root user with $HOME=/mnt/zfs-pool/user-home)

See the official installation guide for detail.

cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

and then

~/.dropbox-dist/dropboxd

Will create Dropbox folder in the user home directory.

Install Dropbox CLI helper

wget "https://linux.dropbox.com/packages/dropbox.py" -o dropbox-cli
sudo cp dropbox-cli /user/local/bin/"

The above will download the Python script helper and install it in $PATH. You can change /user/local/bin/ to anything in $PATH but it MUST not be located in ZFS mount otherwise systemd won't recogize the program.

Install systemd service

The following steps will install the Dropbox daemon and launch Dropbox at bootup.

# Download dropbox-start.target in this post
wget https://gist.githubusercontent.com/kbumsik/b7cc243e297a3a66837151024049f43c/raw/b339fbeee2ba1081723612bec5aacf92cc60e7c2/dropbox-start.target

# Edit the service unit for your needs
vi dropbox-start.service

cp dropbox-start.service /etc/systemd/system/dropbox-start.service
sudo systemctl enable --now dropbox-start.service
[Unit]
Description=Start Dropbox in ZFS at startup
Requires=zfs-mount.service
After=zfs-mount.service
[Service]
# UID or username
User=1000
Type=oneshot
# Make sure dropbox-cli is in $PATH
ExecStart=dropbox-cli start
RemainAfterExit=true
StandardOutput=journal
[Install]
WantedBy=multi-user.target
@acgourley
Copy link

Would anyone be interested in starting a project to apply this approach to a TrueNAS Scale docker app? I know I would find it useful, and could contribute, but don't have the time to fully lead it.

Also: thanks for putting this gist up, I've found it useful so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment