targets.yml
Backup targets are defined in /etc/fsbackup/targets.yml. Targets are grouped by class.
targets.yml is gitignored in the fsbackup repo. Never commit it — it contains host names and paths specific to your environment. Use conf/targets.yml.example as a reference.
Structure
class1:
- id: myapp.data
host: myhost
source: /docker/volumes/myapp_data
type: dir
- id: myapp.db
host: myhost
source: /var/lib/myapp/db
type: dir
rsync_opts:
- "--exclude=*.tmp"
class2:
- id: myhost.nginx.config
host: myhost
source: /etc/nginx
type: dir
Fields
id
Unique identifier for the target. Used as the snapshot directory name. Must be unique across all classes.
Use a descriptive naming convention like <host>.<service>.<type> — e.g. rp.nginx.config, db1.postgres.data.
host
The hostname to connect to via SSH. Must match a known_hosts entry. For local paths on the backup server itself, use host: localhost (in Docker) or host: fs (bare-metal with the hostname set to fs).
source
The absolute path on the remote host to back up.
type
Currently only dir is supported (directory backup via rsync).
rsync_opts (optional)
List of additional rsync options to pass for this target. Common uses:
rsync_opts:
- "--exclude=*.log"
- "--exclude=cache/"
- "--exclude=tmp/"
Exclude paths are relative to the source path, not the remote filesystem root. If source: /docker/volumes/myapp and you want to exclude _data/cache, use --exclude=_data/cache.
Local targets (Docker)
In a Docker deployment, the container cannot SSH to its own host. For paths on the backup server, use host: localhost:
class1:
- id: myapp.data
host: localhost
source: /docker/volumes/myapp_data
type: dir
The path must also be bind-mounted into the container in docker-compose.yml.
Verifying targets
After editing targets.yml, run the doctor to verify all targets are reachable:
docker exec -it fsbackup /opt/fsbackup/bin/fs-doctor.sh --class class1