wiki/Infrastructure/backup-infrastructure.md
2025-02-15 22:05:54 +00:00

39 lines
No EOL
1.5 KiB
Markdown

---
title: Backup infrastructure
description:
published: true
date: 2025-02-15T22:05:51.789Z
tags:
editor: markdown
dateCreated: 2025-02-15T21:28:29.716Z
---
# Backup infrastructure
Our backup infrastructure leverages zfs send/receive functionnality via syncoid from the sanoid package. We use a custom script called bacoid, which gets its config files via zfs config. Backups are sent to two PBS servers that are in lxc containers.
## How to integrate server
Syncoid sends incremental backups via ssh, thus we need to make sure we can ssh to the backup server.
On the production server:
> $ ssh-keygen
> $ zfs set syncoid:target_a=\$user@pbs-koma.ayakael.net:55200 rpool
> $ zfs set syncoid:target_b=\$user@pbs-veita.ayakael.net:55200 rpool
> $ zfs set syncoid:machine=\$machine_name rpool
> $ zfs set syncoid:pool_a=data/pbs rpool
> $ zfs set syncoid:pool_b=data/pbs rpool
On the PBS server
> $ useradd \$user
> $ mkdir /home/\$user/.ssh
> $ vim /home/\$user.ssh/authorized_keys
> $ chown -R \$user /home/$user
> $ zfs allow -u \$guid clone,create,destroy,mount,receive,rollback,send,snapshot data/pbs/\$user
Then you can run `bacoid`
## Config notes
Since zfs config variables are recursive, setting syncoid:* config on rpool will then mean that every volume under it will be backed up. To exclude a volume that you don't want backed up, you can set syncoid:pool_a and syncoid:pool_b as empty.
Also, bacoid does not create a new snapshot when sending a backup. It thus relies on sanoid to create the snapshot, which are then sent with bacoid.