Download the PHP package nazar-pc/btrfs-sync-subvolumes without Composer
On this page you can find all versions of the php package nazar-pc/btrfs-sync-subvolumes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nazar-pc/btrfs-sync-subvolumes
More information about nazar-pc/btrfs-sync-subvolumes
Files in nazar-pc/btrfs-sync-subvolumes
Package btrfs-sync-subvolumes
Short Description This is a pretty naive implementation of replication exact set of subvolumes from one location to another, plays nicely with Just backup btrfs.
License MIT
Homepage https://github.com/nazar-pc/btrfs-sync-subvolumes
Informations about the package btrfs-sync-subvolumes
Btrfs sync subvolumes
This is a pretty naive implementation of replication exact set of subvolumes from one location to another, plays nicely with Just backup btrfs.
Why?
My primary use case is that I'm doing regular snapshots on SSD for my system drive (root, home, etc.) as well as copying them to external HDD, all done by Just backup btrfs natively.
However, I also wanted to make offline backup from time to time and this project does just that, copying all snapshots from online HDD to offline HDD that I'm connecting from time to time.
Requirements
- php-cli (version 5.6+)
Installation
The whole thing is a single file, so first way is just to copy file btrfs-sync-subvolumes
somewhere.
Alternatively you can install it globally using Composer like this:
COMPOSER_BIN_DIR=/usr/local/bin
will instruct Composer to install binary to /usr/local/bin
so that you'll be able to call btrfs-sync-subvolumes
right after installation.
Alternatively you can skip it and add ~/.composer/vendor/bin/
to your PATH.
Removal
If installed manually - just remove file, if installed with Composer - remove it with:
Or without COMPOSER_BIN_DIR=/usr/local/bin
if you didn't use it during installation.
Usage
There are few ways to run script.
or mark file as executable and just
Also you can call it with cron or in some other way:)
What it actually does?
- treats each directory inside
/source/directory
as subvolume - checks whether same subvolume is present in
/target/directory
, if it exists - skips subvolume - for each next subvolume tries to send it as binary diff from previous subvolume
- if it is the first subvolume or copying using diff fails - copies full subvolume
- removes each subvolume from
/target/directory
that is not present in/source/directory
(only if/source/directory
is not empty, just in case something went wrong)
Configuration
There is no configuration or options, feel free to customize script for your needs.
License
MIT, feel free to hack it and share!