ZFS snapshot to S3 uploader.
Project description
ZFS Uploader
ZFS Uploader is a simple program for backing up full and incremental ZFS
snapshots to Amazon S3. It supports CRON based scheduling and can
automatically remove old snapshots and backups. A helpful CLI (zfsup
) lets
you run jobs, restore, and list backups.
Features
- Backup/restore ZFS file systems
- Create incremental and full backups
- Automatically remove old snapshots and backups
- Use any S3 storage class type
- Helpful CLI
Requirements
- Python 3.6 or higher
- ZFS 0.8.1 or higher (untested on earlier versions)
Install Instructions
Commands should be run as root.
- Create a directory and virtual environment
mkdir /etc/zfs_uploader
cd /etc/zfs_uploader
virtualenv --python python3 env
- Install ZFS Uploader
source env/bin/activate
pip install zfs_uploader
ln -sf /etc/zfs_uploader/env/bin/zfsup /usr/local/sbin/zfsup
- Write configuration file
Please see the Configuration File section below for helpful configuration examples.
vi config.cfg
chmod 600 config.cfg
- Start service
cp zfs_uploader.service /etc/systemd/system/zfs_uploader.service
sudo systemctl enable --now zfs_uploader
- List backups
zfsup list
Configuration File
The program reads backup job parameters from a configuration file. Default parameters may be set which then apply to all backup jobs. Multiple backup jobs can be set in one file.
Parameters
bucket_name : str
S3 bucket name.
access_key : str
S3 access key.
secret_key : str
S3 secret key.
filesystem : str
ZFS filesystem.
region : str, default: us-east-1
S3 region.
endpoint : str, optional
S3 endpoint for alternative services
cron : str, optional
Cron schedule. Example: * 0 * * *
max_snapshots : int, optional
Maximum number of snapshots.
max_backups : int, optional
Maximum number of full and incremental backups.
max_incremental_backups_per_full : int, optional
Maximum number of incremental backups per full backup.
storage_class : str, default: STANDARD
S3 storage class.
Examples
Multiple full backups
[DEFAULT]
bucket_name = BUCKET_NAME
region = us-east-1
access_key = ACCESS_KEY
secret_key = SECRET_KEY
storage_class = STANDARD
[pool/filesystem]
cron = 0 2 * * *
max_snapshots = 7
max_incremental_backups_per_full = 6
max_backups = 7
Filesystem is backed up at 02:00 daily. Only the most recent 7 snapshots are kept. The oldest backup without dependents is removed once there are more than 7 backups.
Backblaze B2 S3-compatible endpoint, full backups
[DEFAULT]
bucket_name = BUCKET_NAME
region = eu-central-003
access_key = ACCESS_KEY
secret_key = SECRET_KEY
storage_class = STANDARD
endpoint = https://s3.eu-central-003.backblazeb2.com
[pool/filesystem]
cron = 0 2 * * *
max_snapshots = 7
max_incremental_backups_per_full = 6
max_backups = 7
Structure
full backup (f), incremental backup (i)
- f
- f i
- f i i
- f i i i
- f i i i i
- f i i i i i
- f i i i i i i
- f i i i i i f
- f i i i i f i
- f i i i f i i
- f i i f i i i
- f i f i i i i
- f f i i i i i
- f i i i i i i
Single full backup
[DEFAULT]
bucket_name = BUCKET_NAME
region = us-east-1
access_key = ACCESS_KEY
secret_key = SECRET_KEY
storage_class = STANDARD
[pool/filesystem]
cron = 0 2 * * *
max_snapshots = 7
max_backups = 7
Filesystem is backed up at 02:00 daily. Only the most recent 7 snapshots are kept. The oldest incremental backup is removed once there are more than 7 backups. The full backup is never removed.
Structure
full backup (f), incremental backup (i)
- f
- f i
- f i i
- f i i i
- f i i i i
- f i i i i i
- f i i i i i i
Only full backups
[DEFAULT]
bucket_name = BUCKET_NAME
region = us-east-1
access_key = ACCESS_KEY
secret_key = SECRET_KEY
storage_class = STANDARD
[pool/filesystem]
cron = 0 2 * * *
max_snapshots = 7
max_incremental_backups_per_full = 0
max_backups = 7
Filesystem is backed up at 02:00 daily. Only the most recent 7 snapshots are kept. The oldest full backup is removed once there are more than 7 backups. No incremental backups are taken.
Structure
full backup (f)
- f
- f f
- f f f
- f f f f
- f f f f f
- f f f f f f
- f f f f f f f
Miscellaneous
Storage class codes
- STANDARD
- REDUCED_REDUNDANCY
- STANDARD_IA
- ONEZONE_IA
- INTELLIGENT_TIERING
- GLACIER
- DEEP_ARCHIVE
- OUTPOSTS
Release Instructions
-
Increment version in
__init__.py
file -
Update
CHANGELOG.md
with new version -
Tag release in GitHub when ready. Add changelog items to release description. GitHub Action workflow will automatically build and push the release to PyPi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for zfs_uploader-0.7.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac68db1ef08ba2ac7277b1bed1df3b79f234341cc8822edf9991f89c4da47c0e |
|
MD5 | b7d44d36cb5380d0ee139d197ebde2c6 |
|
BLAKE2b-256 | ed9a3eece9f5cfda2465e9fd43da90db26fc5cb456049d7915476fa74a8e4e78 |