Version: 2026-07-08
Server timezone: Europe/Vilnius
## 0. Goal
This manual describes how to back up a Docker-based Calibre-Web installation from an Ubuntu VPS to pCloud using rclone.
It includes:
- rclone installation on Windows, Linux and macOS;
- pCloud authentication from Windows for a headless Linux VPS;
- server validation commands;
- production backup script;
- validation script;
- restore script;
- daily cron schedule;
- troubleshooting.
## 1. Verified environment from this server
The real server configuration found during our work:
```text
Container: calibre-web
Docker image: lscr.io/linuxserver/calibre-web:latest
Library host path: /root/calibre-library
Library path inside container: /books
Calibre-Web config host path: /root/calibre-web/data
Config path inside container: /config
Published port: 8095 -> 8083
Restart policy: unless-stopped
```
Back up BOTH folders:
```text
/root/calibre-library
/root/calibre-web/data
```
The library contains books and `metadata.db`. The config directory contains Calibre-Web settings, users and application data.
## 2. Target pCloud structure
```text
Backups/
Calibre/
library/
config/
versions/
```
`library` and `config` are current mirrors. `versions` stores changed/deleted files from previous backups.
## 3. Install rclone on Windows
### Option A: download manually
1. Open the official rclone download page: https://rclone.org/downloads/
2. Download the Windows AMD64 ZIP.
3. Extract it, for example to:
```powershell
C:\Tools
clone
```
4. Add this folder to the Windows PATH, or run rclone using the full path:
```powershell
C:\Tools
clone
clone.exe version
```
### Option B: install with Chocolatey
```powershell
choco install rclone
rclone version
```
### Option C: install with Scoop
```powershell
scoop install rclone
rclone version
```
Windows is needed mainly for browser-based pCloud authorization when the VPS has no browser.
## 4. Install rclone on Linux / Ubuntu VPS
Recommended official install method:
```bash
sudo -v
curl https://rclone.org/install.sh | sudo bash
rclone version
```
Alternative using apt, usually older:
```bash
sudo apt update
sudo apt install rclone -y
rclone version
```
## 5. Install rclone on macOS
Using the official script:
```bash
sudo -v
curl https://rclone.org/install.sh | sudo bash
rclone version
```
Using Homebrew:
```bash
brew install rclone
rclone version
```
## 6. Configure pCloud remote on headless VPS using Windows browser
On the VPS run:
```bash
rclone config
```
Choose:
```text
n) New remote
name> pcloud
Storage> pcloud
client_id> [press Enter]
client_secret> [press Enter]
Edit advanced config? n
Use web browser to automatically authenticate rclone with remote? n
```
rclone will print a command similar to:
```bash
rclone authorize "pcloud"
```
On Windows PowerShell run the command exactly as shown by the VPS:
```powershell
rclone authorize "pcloud"
```
A browser opens. Log in to pCloud and authorize rclone. PowerShell will print a large JSON token. Copy the entire JSON token and paste it into the VPS prompt.
Validate on the VPS:
```bash
rclone listremotes
rclone lsd pcloud:
```
Expected result:
```text
pcloud:
```
and a list of pCloud folders.
## 7. Validate Docker and Calibre-Web paths on the VPS
Check running containers:
```bash
docker ps
```
Check all containers, including stopped:
```bash
docker ps -a | grep -i calibre
```
Check container mounts:
```bash
docker inspect calibre-web --format '{{range .Mounts}}{{println .Source "->" .Destination}}{{end}}'
```
Expected:
```text
/root/calibre-library -> /books
/root/calibre-web/data -> /config
```
Check library file:
```bash
ls -lah /root/calibre-library/metadata.db
```
Check config folder:
```bash
ls -lah /root/calibre-web/data
```
## 8. Create backup script on the VPS
Create the script:
```bash
sudo nano /usr/local/bin/backup-calibre-pcloud.sh
```
Paste this:
```bash
#!/usr/bin/env bash
set -euo pipefail
# ==========================================================
# Calibre-Web -> pCloud backup via rclone
# Server: Ubuntu VPS
# Container: calibre-web
# Library: /root/calibre-library
# Config: /root/calibre-web/data
# ==========================================================
SOURCE_LIBRARY="/root/calibre-library"
SOURCE_CONFIG="/root/calibre-web/data"
REMOTE_LIBRARY="pcloud:Backups/Calibre/library"
REMOTE_CONFIG="pcloud:Backups/Calibre/config"
REMOTE_VERSIONS="pcloud:Backups/Calibre/versions/$(date +%F_%H-%M-%S)"
CONTAINER="calibre-web"
LOG="/var/log/calibre-pcloud-backup.log"
LOCK="/tmp/calibre-pcloud-backup.lock"
exec 9>"$LOCK"
if ! flock -n 9; then
echo "$(date '+%F %T') ERROR: backup already running" >> "$LOG"
exit 1
fi
START_AGAIN=false
finish() {
local exit_code=$?
if [ "$START_AGAIN" = true ]; then
if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER}
quot;; then
echo "$(date '+%F %T') Starting container after backup/error: $CONTAINER" >> "$LOG"
docker start "$CONTAINER" >> "$LOG" 2>&1 || true
fi
fi
if [ $exit_code -eq 0 ]; then
echo "$(date '+%F %T') Backup finished successfully" >> "$LOG"
else
echo "$(date '+%F %T') ERROR: backup failed with exit code $exit_code" >> "$LOG"
fi
echo "==================================================" >> "$LOG"
echo "" >> "$LOG"
exit $exit_code
}
trap finish EXIT
echo "==================================================" >> "$LOG"
echo "$(date '+%F %T') Backup started" >> "$LOG"
# Basic checks
command -v rclone >/dev/null 2>&1 || { echo "ERROR: rclone not installed" >> "$LOG"; exit 1; }
command -v docker >/dev/null 2>&1 || { echo "ERROR: docker not installed" >> "$LOG"; exit 1; }
rclone listremotes | grep -q '^pcloud: