Btrfs simple snapshots
Take snapshots of your btrfs subvolumes and apply a retention policy in order to keep your snapshot directory somewhat clean and small.
The retention policy, defined bellow, is hardcoded for now but it should be enought for the average use case. I may adjust it, or provide a way to change it at runtime if needed.
Hourly snapshots are kept for 24 hours
Daily snapshots are kept for 4 weeks
Weekly snapshots are kept for 12 weeks
Monthly snapshots are kept for a year
yearly snapshots are kept for 10 years
Every subvolume that should be snapshoted must be given as argument to the script. For example if you want to snapshot every home directory created as subvolumes and your /etc and /srv directory you would do
btrfs-simple-snapshots /home/* /etc /srv
Once done, you will find a new subvolume named .snapshots inside the snapshoted subvolume with a name formated as %Y-%m-%d-%H%M%S
Installation
Install from pip using pip install btrfs-simple-snapshots. Then you can run it as root or with a user able to manage btrfs subvolumes. It is probably a good thing to run it automatically with a cron job. Depending on you need you may run it once per day (at 2 a.m.) to snapshot every home folder (created as subvolumes) with this kind of job definition.
0 2 * * * python -m btrfs_simple_snapshots /home/*
Release files for btrfs-simple-snapshots 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| btrfs-simple-snapshots-0.1.4.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| btrfs_simple_snapshots-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.9 kB
Release files / btrfs-simple-snapshots-0.1.4.tar.gz
| Download URL | btrfs-simple-snapshots-0.1.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bde6d1d6cbf4105572c09e53f271a7166f1d695e212345f60efc234a7463ad8c
|
|
BLAKE2b-256 checksum How to use checksums |
0ee17382df14c15af6af35674b359032be5d281f42d9598337fe626c6f765452
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / btrfs_simple_snapshots-0.1.4-py3-none-any.whl
| Download URL | btrfs_simple_snapshots-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3f4bf31934ea71c07d5c1ae83f6c4cb21df103584d6689c5cd1de443966e19b0
|
|
BLAKE2b-256 checksum How to use checksums |
4725063b56136db1f7f7f557e00846e307110b6355ef5d8c83000349b085d62a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |