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

Does this tool support online rollback? #37

Open
developer91234 opened this issue Jul 27, 2024 · 3 comments
Open

Does this tool support online rollback? #37

developer91234 opened this issue Jul 27, 2024 · 3 comments

Comments

@developer91234
Copy link

Not clear from the documentation and I don't have an arch btrfs system to test. Would you be able to rollback the mounted root subvolume in place? Also, if I were booted into a snapshot, the rollback script would rollback the root subvolume, correct?

@hirak99
Copy link
Owner

hirak99 commented Jul 28, 2024

Yes, online rollback is supported.

The yabsnap rollback-gen ID command generates a short bash script.

You will need to review the script and run it manually (or type in the commands one by one).

It can be run from the system mounted on the root which you want to roll back. After you run the script, the system will continue to function with the current snapshot until you reboot, upon which the rollback will take effect.

For rollback to work correctly, root should be mounted (in fstab) with subvol= and not subvolid=.

@hirak99
Copy link
Owner

hirak99 commented Jul 28, 2024

Also fyi, here's an example of rollback script it generates. This should clarify exactly how the rollback process works.

Command -

$ yabsnap rollback-gen 20240728183030

Output -

#!/bin/bash
# Save this to a script, review and run as root to perform the rollback.

set -uexo pipefail

mkdir -p /run/mount/_yabsnap_internal_0
mount /dev/mapper/luksdev /run/mount/_yabsnap_internal_0 -o subvolid=5

cd /run/mount/_yabsnap_internal_0

mv @home @.snapshots/rollback_20240728192848_@home
btrfs subvolume snapshot /.snapshots/@home-20240728183030 @home

mv @ @.snapshots/rollback_20240728192848_@
btrfs subvolume snapshot /.snapshots/@root-20240728183030 @

echo Please reboot to complete the rollback.
echo
echo After reboot you may delete -
echo "# sudo btrfs subvolume delete /.snapshots/rollback_20240728192848_@home"
echo "# sudo btrfs subvolume delete /.snapshots/rollback_20240728192848_@"

@developer91234
Copy link
Author

Thanks. Please consider letting the user do rollbacks without saving the script as this is quite cumbersome. After all the operation is reversible, maybe just inform the user of the changes after they're done and allow them to undo it if they want.

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

2 participants