Your backups should be the exact copy of your main system. Taking backups should be easy, like Agent Smith does.
Backup operations involve many actions, such as attaching physical disk(s) (decrypting/opening/mounting multiple levels of layers and multiple partitions), sending changes, generating logs, generating restoration scripts, cleaning up, etc... That's why full backup operations are not simple and every backup procedure will be diverged eventually.
This leads the system admins to write their own scripts around the general purpose tools they choose. Problem arises here: the surrounding scripts would be highly complex and hard to maintain.
This project is filling the gap by providing high level Bash functions and scripts for backup tasks (BTRFS in mind, but will fit for any scenario) in order to keep "surrounding scripts" very simple, easily customizable, maintainable.
This project describes a "backup" as "the exact copy of your whole main hard disk". You should grab your backup disk, boot your (or an equivalent) computer and continue your work where you left. Your backup tool (that you built on smith-sync) will have the following properties:
- Backup disks are kept ready to boot the computer from the latest snapshot.
- Backup procedure should not consume more than a few minutes for detecting the changes for 1 TB of real world data.
- Backup disks should be tested with an hypervisor (eg. VirtualBox) to prove that they are always ready to boot.
- Main system should keep snapshots of previous states and ready to rollback at any time.
- Backup (or main) disks should be prepared for theft. No data should be extracted from a stolen backup disk (or computer).
This project provides the necessary tools to satisfy above requirements.
See erik-sync for an example usage. erik-sync
is my current, everyday backup toolset.
Even though the available tools are standalone, it's highly encouraged to build your own toolset around smith-sync:
-
Create your own toolset
git init mybackupsystem cd mybackupsystem
-
Add
smith-sync
as a submodulegit submodule add https://github.com/ceremcem/smith-sync git submodule update --recursive
-
Create a script for each task (attach, detach, sync, take-snapshot, ...)
- Use
smith-sync
tools with relative paths - Use functions available in
smith-sync/lib
- Use
(See doc)
Shell scrip to synchronize source and destination with the same hierarchy.
./btrfs-sync /path/to/source/snapshots /path/to/dest/snapshots
Same as rsync
but uses a default exclude-list.txt
which is optimized for rootfs backups.
./rsync.sh /path/to/source/ /path/to/dest/
Although I use these tools in my everyday backup tasks, you MUST take appropriate actions (eg. multiple offline backups) in order not to loose/destroy your backups and even your operating system. In other words, use at your own risk.