Quick overview
This workflow collects backup settings via an n8n form, creates a Borg backup of a server directory over SSH, packages the Borg repository into a tar.gz archive, and uploads it to a chosen Google Drive folder in either sync (single latest file) or versioned mode.
How it works
- Receives backup settings from an n8n form (basic-auth protected) and stores them in an n8n Data Table for reuse on scheduled runs.
- Runs on a schedule and loads the saved configuration from the Data Table to determine the source directory, encryption setting, and Google Drive upload mode.
- Connects to the server over SSH, installs BorgBackup if needed, and builds a runtime plan including repository path, archive name, and staging file name.
- Creates a Borg backup archive of the configured directory (optionally using an on-server passphrase file), then prunes to keep the latest archive and compacts the repository.
- Compresses the Borg repository into a single tar.gz file on the server, then downloads the archive into the workflow.
- If sync mode is enabled, searches Google Drive for an existing “latest-backup” file and either updates it or uploads a new one; if versioned mode is enabled, uploads a new timestamped backup file each run.
- Removes the temporary staged archive from the server after the Google Drive upload completes.
Setup
- Add a Google Drive OAuth credential and note the destination Google Drive folder ID where backups should be stored.
- Open the form trigger, set the basic-auth username/password, then run the workflow once to submit the source directory, encryption choice/passphrase, Drive folder ID, and backup mode (this saves config to the Data Table).
- If using encryption, ensure the provided passphrase is correct and can be stored on the server at
~/.borg/passphrase by the SSH user.
- Configure the Schedule Trigger interval to control how often the backup runs.
Requirements
- SSH access to your Linux server.
- A Google Drive account connected to n8n.
- Borg Backup installed on the server (the workflow can install it automatically on supported Linux distributions).
Customization
- You can update the source directory, switch between Sync and Versioned modes, choose a different Google Drive folder, or modify the backup schedule at any time by running the setup form again.
Additional info
👤 Who's it for?
This workflow is ideal for system administrators, developers, and homelab users who want an automated, reliable backup solution for Linux servers without managing additional backup infrastructure.