Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bcachefs, snapshot and rsync as "poor man's send and receive" #783

Open
Nihon-Ryori opened this issue Nov 17, 2024 · 0 comments
Open

Bcachefs, snapshot and rsync as "poor man's send and receive" #783

Nihon-Ryori opened this issue Nov 17, 2024 · 0 comments

Comments

@Nihon-Ryori
Copy link

Nihon-Ryori commented Nov 17, 2024

The code serves as a suggestion. Everyone is free to improve the code. For example, you could choose a variant for data transmission that enables backup even over really poor Internet connections.

poor_mans_send_and_receive.sh

# [Nihon-Ryori](https://github.com/Nihon-Ryori)
# Open Source Code. Feel free to use the Code for bcachefs project or what ever.
# 2024-11-18, ver 001
# This untested code should do a Bcachefs snapshot and rsync,  as "poor man's send and receive".

# Untested Code. Use the code at your own risk and only if you would write it yourself. The code is only intended for test use with a test system that does not contain any data that is still required.

#!/bin/bash

Echo "Create snapshot"
snapshot_id=$(date +%Y%m%d_%H%M%S)
bcachefs snapshot create $snapshot_id
Echo "Snapshot created"

Echo "Run syncronize"
rsync -avh --delete --hard-links /pfad/zum/Quellordner/ /pfad/zum/Zielordner/ \
    --exclude-from=/pfad/exkludierte_dateien.txt \
    --link-dest=/pfad/quellordner_snapshot_$snapshot_id
Echo "rsync finished"

# Delete Snapshot after syncronize"
bcachefs snapshot delete $snapshot_id

echo "poor man's send and receive completed."

echo "Press Enter to end the script"; read -r
@Nihon-Ryori Nihon-Ryori changed the title Bcachefs, snapshot and rsync as "poor man's send and recive" Bcachefs, snapshot and rsync as "poor man's send and receive" Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant