Repository navigation
Development
This page is for you if you want to change zfs-autobackup, or run it directly from git.
This is optional. You can also install the requirements globally.
psy@ws1:~/zfs_autobackup$ python3 -m venv backupdev
psy@ws1:~/zfs_autobackup$ source backupdev/bin/activate
(backupdev) psy@ws1:~/zfs_autobackup$ pip install -r requirements.txtRun the tools as Python modules:
(backupdev) psy@ws1:~/zfs_autobackup$ python -m zfs_autobackup.ZfsAutobackup --version
(backupdev) psy@ws1:~/zfs_autobackup$ python -m zfs_autobackup.ZfsAutoverify --versionI use test-driven development. Usually I write the code and its tests together.
The tests use real ZFS commands. They make many temporary pools with loopback images in /tmp.
This is the easiest method. It tests against the ZFS kernel module of your system, with the Alpine ZFS userspace tools.
From the main repository:
./tests/run_tests_dockerTo run only some tests, use the unittest -k option:
./tests/autorun_tests_docker -k test_thinner.TestThinnerThis is more difficult:
- The tests need root.
- The tests need SSH to
root@localhost. They make and install an SSH key if necessary.
This takes a few minutes. GitHub Actions also runs it for each commit.
(backupdev) root@ws1:/home/psy/zfs_autobackup# ./tests/run_tests(backupdev) root@ws1:/home/psy/zfs_autobackup# ./tests/run_test test_verify.pyThis needs PyCharm Professional, but it is the easiest method. PyCharm uploads the tests and runs them on a remote Linux server via SSH. This is also good if you develop on macOS or Windows.
Add an SSH interpreter for a remote server with ZFS.
The tests must run as root, but you want to start them from the editor. To do this:
-
Make a venv.
-
Replace the
pythonsymlink in the venv with a copy of the binary. -
Make the copy setuid root:
user@host:~/zfs_autobackup/venv/bin$ sudo chown root:root python user@host:~/zfs_autobackup/venv/bin$ sudo chmod 4755 python
Warning: This is a security risk. Do this only on a development system.
zfs-autobackup:
- Introduction (README.md)
- Getting started
- Full manual
- Mounting backup datasets
- Performance tips (recommended)
- Common problems and errors
- Thinning out obsolete snapshots
- Common snapshots, holds and bookmarks
- Handling ZFS encryption
- Transfer buffering, compression and rate limiting.
- Custom Pre- and post-snapshot commands
- Monitoring
Examples: