digint / digint/btrbk

Feature request : BTRBK + grub-btrfs - Restore the snapshot currently booted - like Timeshift

Open
#580 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
2.1k
Forks
139
PR merge metrics
No merged PRs in 30d

Description

### Usecase description
When using grub-btrfs in addition to BTRBK, it is possible to **boot on a selected snapshot** in grub.

To restore a snapshot, it is then mandatory :
- either to **manually select** it by name or entry,
- or to select the last one by ID or with `btrbk ls /` command.

It is not possible to "automatically" **select the current snapshot** mounted on "/" to restore it.

### Current workaround

My workaround is the following :
- when **creating** the snapshot : doing first a `btrbk dryrun` to get the snapshot name and logging it in `/etc/btrbk/last_snapshot.log` ; then doing the `btrbk run` to actually create the snapshot with his own name "embedded" in it,
- when **restoring** the snapshot : reading the value from `/etc/btrbk/last_snapshot.log` as the entry.

This works as intended, because the `/etc/btrbk/last_snapshot.log` in the snapshot is the one just before the snapshot was actually made (overwritten with each snapshot).

However, this is not a "clean way" to do it, as I have to set "timestamp_format short" to avoid logging a wrong name, and not lauching the full command near to midnight as it could as well logging a wrong name.

*Precision : Neither `blkid`, `lsblk`, `mount` or `findmnt` -like commands seems to be able to know we booted on a btrfs snapshot, which seems strange (but I'm not a btrfs expert). This is why I let down the idea of getting the current booted snapshot name during the restoring phase.*

EDIT : I found another workaround using `dmesg` boot logs, which has to be done from the snapshot itself.
```
dmesg | grep "Command line"
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.