inital readme
This commit is contained in:
37
README.md
Normal file
37
README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# snap-sync
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
This bash script sends incremental snapshots to another drive for backing up
|
||||||
|
data. Plug in and mountany btrfs-formatted device you want your system to be
|
||||||
|
backed up to (like a USB drive). When you run the script you will be prompted
|
||||||
|
to select a mounted btrfs device.
|
||||||
|
|
||||||
|
The script iterates through all snapper configurations. For each configuration
|
||||||
|
it creates a new local snapshot. If you have never synced to the specified
|
||||||
|
device you will be prompted to enter a directory on the device where the backup
|
||||||
|
snapshots will go. Additionally you are show the location of the backed up
|
||||||
|
snapshot. If you have performed a backup to this device before, only the changes
|
||||||
|
since the last backup have to be sent.
|
||||||
|
|
||||||
|
snapper is required.
|
||||||
|
|
||||||
|
## Example output
|
||||||
|
|
||||||
|
Selected a mounted BTRFS device to backup to.
|
||||||
|
1) 43cedfb6-8775-43be-8abc-ee63bb92e10e (/)
|
||||||
|
2) 43cedfb6-8775-43be-8abc-ee63bb92e10e (/.snapshots)
|
||||||
|
3) 43cedfb6-8775-43be-8abc-ee63bb92e10e (/home)
|
||||||
|
4) 7360922b-c916-4d9f-a670-67fe0b91143c (/run/media/wes/backup)
|
||||||
|
0) Exit
|
||||||
|
Enter a number: 4
|
||||||
|
You selected the disk with UUID 7360922b-c916-4d9f-a670-67fe0b91143c.
|
||||||
|
At 'home' configuration
|
||||||
|
Backup location: /run/media/wes/backup/acer-c720/home/1097/
|
||||||
|
Continue (y/n)? y
|
||||||
|
At subvol /home/.snapshots/1097/snapshot
|
||||||
|
At 'root' configuration
|
||||||
|
Backup location: /run/media/wes/backup/acer-c720/root/2288/
|
||||||
|
Continue (y/n)? y
|
||||||
|
At subvol //.snapshots/2288/snapshot
|
||||||
|
Done!
|
||||||
16
backup
16
backup
@@ -7,18 +7,10 @@
|
|||||||
# snapshot created on your system since that will be used to determine the
|
# snapshot created on your system since that will be used to determine the
|
||||||
# difference for the next incremental snapshot.
|
# difference for the next incremental snapshot.
|
||||||
|
|
||||||
# Can set the backup directory here, or in the snapper configuration file with
|
|
||||||
# EXT_BACKUP_LOCATION
|
|
||||||
declare -r description="latest incremental backup"
|
|
||||||
|
|
||||||
# You can set a snapper configuration to be excluded by setting EXT_BACKUP="no"
|
|
||||||
# in its snapper configuration file.
|
|
||||||
|
|
||||||
#--------------------------------------------------------
|
|
||||||
# Don't modify anything below here
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
declare -r description="latest incremental backup"
|
||||||
|
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
printf "Script must be run as root.\n"
|
printf "Script must be run as root.\n"
|
||||||
exit
|
exit
|
||||||
@@ -108,7 +100,7 @@ for x in $SNAPPER_CONFIGS; do
|
|||||||
|
|
||||||
if [[ -z "$old_number" ]]; then
|
if [[ -z "$old_number" ]]; then
|
||||||
|
|
||||||
btrfs send "$new_snapshot" | btrfs receive "$backup_location"
|
btrfs send "$new_snapshot" | btrfs receive "$backup_location" &>/dev/null
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -128,6 +120,4 @@ for x in $SNAPPER_CONFIGS; do
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
date > "$HOME"/.lastbackup
|
|
||||||
|
|
||||||
printf "Done!\n"
|
printf "Done!\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user