zsync/README.md

72 lines
2.0 KiB
Markdown
Raw Normal View History

2023-05-23 21:56:53 +02:00
---- THIS IS A CLONE OF THE ORIGINAL REPOSITORY ON git.bashclub.org ----
2023-02-18 11:05:44 +01:00
# zsync
2023-02-23 20:19:11 +01:00
ZFS replication script by Thorsten Spille <thorsten@spille-edv.de>
2023-03-05 00:28:46 +01:00
- replicates ZFS filesystems/volumes with user parameter bashclub:zsync (or custom name) configured
2023-11-06 09:53:50 +01:00
- creates optional snapshot before replication (required zfs-auto-znapshot)
2023-03-05 00:28:46 +01:00
- parameter setting uses zfs hierarchy on source
- mirrored replication with existing snapshots (filtered by snapshot_filter)
- pull/local replication only
2023-11-06 09:53:50 +01:00
- auto creates full path on target pool, enforce com.sun:auto-snapshot=false, inherits mountpoint and sets canmount=noauto
2023-03-05 00:28:46 +01:00
- raw replication
2023-11-06 09:53:50 +01:00
- tested on Proxmox VE 7.x/8.x
2023-03-05 00:28:46 +01:00
- ssh cipher auto selection
2023-02-23 20:19:11 +01:00
## Installation
#### Download and make executable
~~~
wget -q --no-cache -O /usr/bin/bashclub-zsync https://git.bashclub.org/bashclub/zsync/raw/branch/main/bashclub-zsync/usr/bin/bashclub-zsync
chmod +x /usr/bin/bashclub-zsync
bashclub-zsync
~~~
## Configuration
After first execution adjust the default config file `/etc/bashclub/zsync.conf`:
~~~
# target path on local machine
target=backup/px1
# source host
source=user@host
# source host ssh port
sshport=22
# tag to mark source filesystem
tag=bashclub:zsync
# snapshot name filter
snapshot_filter="hourly|daily|weekly|monthly"
2023-03-05 00:28:46 +01:00
# number of minimum snapshots to keep (per snapshot filter)
min_keep=3
2023-11-06 09:53:50 +01:00
# number of zfs snapshots to keep on source (0 = snapshot function disabled)
zfs_auto_snapshot_keep=0
# make snapshot via zfs-auto-snapshot before replication
zfs_auto_snapshot_label="backup"
2023-02-23 20:19:11 +01:00
~~~
### Define a cronjob
#### cron.d example
File: /etc/cron.d/bashclub-zsync
~~~
2023-05-15 15:51:39 +02:00
00 23 * * * root /usr/bin/bashclub-zsync -c /etc/bashclub/zsync.conf > /var/log/bashclub-zsync/zsync.log
2023-02-23 20:19:11 +01:00
~~~
#### cron.{hourly|daily|weekly|monthly}
File: /etc/cron.hourly/bashclub-zsync
~~~
2023-05-15 15:51:39 +02:00
/usr/bin/bashclub-zsync -c /etc/bashclub/zsync.conf > /var/log/bashclub-zsync/zsync.log
2023-02-23 20:19:11 +01:00
~~~
2023-03-15 15:43:18 +01:00
# Author
### Thorsten Spille
[<img src="https://storage.ko-fi.com/cdn/brandasset/kofi_s_tag_dark.png" rel="Support me on Ko-Fi">](https://ko-fi.com/thorakel)