The goal is to provide a simple - yet powerfull - snapshots management tool. It can create them periodically or manually, with description and metadata. Delete them automatically when they expire. Backup them to an external drive for backing-up data, because snapshots are not backups.
Clone the repository and get inside it
git clone https://github.com/Babilinx/2backup && cd 2backup
Install it with make
sudo make install
- Profiles creation, suppression, listing and showing details
- Snapshots creation
- Snapshots suppresion (only profile one)
- Specific snapshot deletion
- Snapshots listing
- Show snapshot infos
- Snapshot mounting/unmonting
- Rollback an entire profile
- Rollback a specific snapshot
Note: you can use
2backup
command as well asbb
for faster use.
All commands needs root rights (except some but it's better with root anyways)
For every subvolume that you want to backup, you will need to have a .snapshots
subvolume at is root (mounted or nested).
When that's done, you can continue with the profiles section.
Profiles are specific for one (or more) subvolume(s). They contains rules about auto-snapshoting and auto-deletion.
"system" profile:
#/etc/2backup/profiles/system
# Affects only @, @var, @root and @boot subvolumes
SUBV=("@" "@var" "@boot" "@root")
# Mount points of each subvolume
SUBV_MNTPT=("/" "/var" "/boot" "/root")
TIMELINE_LIMIT_HOURLY="5" # Keep 5 hourly snapshots
TIMELINE_LIMIT_DAILY="7" # Keep 7 daily snapshots
TIMELINE_LIMIT_WEEKLY="0" # Do not make/keep weekly snapshots
TIMELINE_LIMIT_MONTHLY="0" # Do not make/keep mounthly snapshots
TIMELINE_LIMIT_YEARLY="0" # Do not make/keep yearly snapshots
Create it
2backup profile create <profile>
And edit the settings
sudoedit /etc/2backup/profiles/<profile>
Note:
sudoedit
is a tool to edit files as root without doingsudo <editor> <file>
. You can use any editor as root instead.
Just delete it
2backup profile delete <profile>
And say "y" (or "n" if you want to keep it)
List them
2backup profile list
Get the infos
2backup profile show <profile>
Note: They are never deleted automaticaly
Create it
2backup snapshot create <profile> -m <description>
Create it
2backup snapshot create <profile>
And enter the description with your file editor
Note: It can contain more than one snapshot!
List snapshots
2backup snapshot list -p <profile>
And delete it
2backup snapshot delete <snapshot ID> -p <profile>
Get his hash
2backup snapshot list
And delete it
2backup snapshot delete <snapshot hash>
List them
2backup snapshot list
List them
2backup snapshot list -p <profile>
Mount it
2backup snapshot mount <snapshot hash>
Access it
Unmount it
2backup snapshot umount <snapshot ID | snapshot hash>
2backup rollback <snapshot ID> -p <profile>
2backup rollback <snapshot hash>
Go inside 2backup repository, and execute
make update
Re-install it if there is any updates
sudo make install
Go inside 2backup repository, and execute
sudo make uninstall
Get out the repo and delete it
cd .. && rm -rf 2backup/
2backup Copyright (C) 2023 Babilinx
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see 'https://www.gnu.org/licenses/gpl-3.0.en.html' for details.
Usage:
2backup [options] [arguments]
bb [options] [arguments]
Options:
profile Interact with profiles.
arguments:
create <profile> Create a profile.
delete <profile> Delete a profile.
list List all profiles.
show <profile> Show infos of a profile.
snapshot Interact with snapshots.
arguments:
create <profile> Create a snapshot of a profile, with the description given after.
create <profile> -m <description> Create a snapshot of a profile with the giver description.
delete <snapshot ID> -p <profile> Delete a profile's snapshot (can contain more than one snapshot).
delete <snapshot hash> Delete a given snapshot.
list List all snapshots.
list -p <profile> List all snapshots of a profile.
show <snapshot hash> Show infos on a snapshot.
show <snapshot ID> -p <profile> Show infos on a snapshot of a profile.
mount <snapshot ID> -p <profile> Mount a snapshot of a profile.
mount <snapshot hash> Mount a given snapshot.
umount <snapshot ID> -p <profile> Unmount a snapshot of a profile.
umount <snapshot hash> Unmount a given snapshot.
rollback Do rollback stuff.
arguments:
<snapshot hash> Rollback the given snapshot.
<snapshot ID> -p <profile> Rollback a profile to the given snapshot.