{"id":13936291,"url":"https://github.com/larrabee/ebt","last_synced_at":"2025-08-01T11:05:46.565Z","repository":{"id":57425378,"uuid":"43431759","full_name":"larrabee/ebt","owner":"larrabee","description":"Flexible backup framework","archived":false,"fork":false,"pushed_at":"2020-09-24T09:31:53.000Z","size":166,"stargazers_count":27,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T01:41:35.741Z","etag":null,"topics":["backup","btrfs","cli","diff-backups","diff-dd","libvirt","libvirt-vm","linux","lvm2","mysql","python","rsync","snapshot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/larrabee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-30T12:33:30.000Z","updated_at":"2024-04-25T19:02:15.000Z","dependencies_parsed_at":"2022-08-29T22:51:27.064Z","dependency_job_id":null,"html_url":"https://github.com/larrabee/ebt","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrabee%2Febt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrabee%2Febt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrabee%2Febt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/larrabee%2Febt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/larrabee","download_url":"https://codeload.github.com/larrabee/ebt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251549114,"owners_count":21607353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","btrfs","cli","diff-backups","diff-dd","libvirt","libvirt-vm","linux","lvm2","mysql","python","rsync","snapshot"],"created_at":"2024-08-07T23:02:32.873Z","updated_at":"2025-04-29T17:30:36.397Z","avatar_url":"https://github.com/larrabee.png","language":"Python","readme":"# Enhanced Backup Tool\n\n## Overview\nThis is backup framework for creating flexible backup scripts.\n\n## Features\n1. Module for upload backups to Amazon Glacier and remove old Glacier backups.\n2. MySQL module support creating backup with mysqldump and InnoBackupEx.\n3. LVM module for snapshots.\n4. Full/Diff backups of files backups with rsync.\n5. Full/Diff backups of btrfs with btrfs send/receive.\n6. Full/Diff backups of any binary files or block devices with diff-dd.\n7. Full/Diff backups of Libvirt VM's.\n8. Full/Diff backups of Libvirt VM's with external snapshots (works with qcow, qcow2, and raw file block devices).\n9. Full/Diff backups of S3 buckets (beta, can work with Amazon S3, Ceph and other S3 storage)\n10. Predefined jobs for popular cases.\n\n## Install\n1. Install following dependency with your OS package manager:  \nFor CentOS:\n```\nhttp://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm (Percona repo)\nlibvirt-python\npython-pip\nrsync\nlvm2\np7zip\nbtrfs-progs\npigz\nPercona-Server-client-57\npercona-xtrabackup-24\n```\nFor Debian/Ubuntu:\n```\nhttps://repo.percona.com/apt/percona-release_0.1-4.$(lsb_release -sc)_all.deb (Percona repo)\npython-libvirt\npython-setuptools\npython-pip\nrsync\nlvm2\np7zip\nbtrfs-progs\npigz\nPercona-Server-client-57\npercona-xtrabackup-24\n```\n2. Install python package from pip:\n```\npip install ebt\n```\n\n## Configure\nConfiguration files stored in `/etc/ebt/` directory.\nFile `/etc/ebt/ebt.conf` contain logging configuration.\n\nFile `/etc/ebt/plans.py` contains your backups jobs. Few examples of `plans.py`:\n\n```python\nimport ebt_jobs.btrfs\n\n\ndef btrfs_root_full():\n    backup = ebt_jobs.btrfs.BTRFSBackupFull(source='/', snap_dir='/.snap', dest_dir='/mnt/backup', day_exp=None, store_last=1)\n    backup.start()\n\ndef btrfs_root_diff():\n    backup = ebt_jobs.btrfs.BTRFSBackupDiff(source='/', snap_dir='/.snap', dest_dir='/mnt/backup', day_exp=None, store_last=5)\n    backup.start()\n```\nThis example of using predefined job `ebt_jobs.btrfs.BTRFSBackupDiff`. You can see all jobs in `ebt_jobs/` directory.\n\nNext example. You can inheritance your own class from base class:\n```python\nimport ebt_jobs.btrfs\nimport ebt_system\n\nclass BTRFSBackupFullWithRsync(ebt_jobs.btrfs.BTRFSBackupFull):\n    def _post_backup(self):\n        ebt_system.popen(command=\"rsync /usr/bin/rsync {0} remote:/mnt/backup/archive/\".format(self.dest), shell=True)\n\nclass BTRFSBackupDiffWithRsync(ebt_jobs.btrfs.BTRFSBackupDiff, BTRFSBackupFullWithRsync):\n    pass\n\ndef btrfs_root_full():\n    backup = BTRFSBackupFullWithRsync(source='/', snap_dir='/.snap', dest_dir='/mnt/backup', day_exp=None, store_last=1)\n    backup.start()\n\ndef btrfs_root_diff():\n    backup = BTRFSBackupDiffWithRsync(source='/', snap_dir='/.snap', dest_dir='/mnt/backup', day_exp=None, store_last=5)\n    backup.start()\n```\nYou can write your own jobs from primitives that can be found in `ebt_*` dirs.\n\n## EBT cli Usage\n```\nroot » ebt --help\nusage: ebt [-h] [-j JOBS [JOBS ...]] [-p PLAN] [-c CONFIG] [-v]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -j JOBS [JOBS ...], --jobs JOBS [JOBS ...]\n                        List of jobs to run\n  -p PLAN, --plan PLAN  Custom path to plans file\n  -c CONFIG, --config CONFIG\n                        Custom path to config file\n  -v, --version         Display program version and exit\n```\nWhere `-j or --jobs` is the functions names from your `plans.py` file. Example: `ebt -j btrfs_root_full btrfs_root_diff`\nIf you specified few jobs they will be executed in sequential order.\n\n## Diff-dd cli Usage\nYou can use for restoring diff backups of Libvirt VM's or for creating diff backups from external scripts.\n\nBackup examples:\n```\nddd --if /backup/full_disk_copy.raw --df /dev/lvm/changed_disk_snapshot --of /backup/diff_disk_copy.ddd\nddd --if /backup/full_disk_copy.raw --df /dev/lvm/changed_disk_snapshot \u003e /backup/diff_disk_copy.ddd\nddd --if /backup/full_disk_copy.raw --df /dev/lvm/changed_disk_snapshot | gzip \u003e /backup/diff_disk_copy.ddd.gz\nddd --if \u003c(zcat /backup/full_disk_copy.raw.gz) --df /dev/lvm/changed_disk_snapshot --of /backup/diff_disk_copy.ddd\nzcat /backup/full_disk_copy.raw.gz | ddd --df /dev/lvm/changed_disk_snapshot --of /backup/diff_disk_copy.ddd\ncat /dev/lvm/changed_disk_snapshot | ddd --if \u003c(zcat /backup/full_disk_copy.raw.gz) --of /backup/diff_disk_copy.ddd\nddd --if \u003c(ssh remotehost cat /backup/full_disk_copy.raw) --df \u003c(ssh remote2host cat /dev/lvm/changed_disk_snapshot) | ssh remote3host dd of=/backup/diff_disk_copy.ddd\n```\n\nRestore examples:\n```\nddd --mode restore --if /backup/full_disk_copy.raw --df /backup/diff_disk_copy.ddd --of /dev/lvm/disk\nddd --mode restore --if \u003c(zcat /backup/full_disk_copy.raw.gz) --df \u003c(zcat /backup/diff_disk_copy.ddd.gz) \u003e /dev/lvm/disk\nzcat /backup/full_disk_copy.raw.gz | ddd --mode restore --df \u003c(ssh remotehost cat /backup/diff_disk_copy.ddd.gz) | ssh remote2host dd of=/dev/lvm/disk\n```\n\n## Diff-dd API Usage\nBackup:\n```\nimport ebt_files\nimport gzip\niffd = gzip.open('/backup/full_disk_copy.raw.gz', 'rb')\ndffd = open('/dev/lvm/changed_disk_snapshot', 'rb')\noffd = gzip.open('/backup/diff_disk_copy.ddd', 'wb')\n\ndiffer = ebt_files.ddd.CreateDiff(iffd=iffd, dffd=dffd, offd=offd, block_size=16384)\ndiffer.start()\n```\n\nRestore:\n```\nimport ebt_files\niffd = gzip.open('/backup/full_disk_copy.raw.gz', 'rb')\ndffd = gzip.open('/backup/diff_disk_copy.ddd', 'rb')\noffd = open('/dev/lvm/disk', 'wb')\n\ndiffer_restore = ebt_files.ddd.RestoreDiff(iffd=iffd, dffd=dffd, offd=offd, block_size=16384)\ndiffer_restore.start()\n```\n\n## License\nGPLv3\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarrabee%2Febt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flarrabee%2Febt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flarrabee%2Febt/lists"}