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

Update README.md #197

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 57 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
This is a version 4.xx of grub-btrfs
##### BTC donation address: `1Lbvz244WA8xbpHek9W2Y12cakM6rDe5Rt`
- - -
### Description :
Improves Grub by adding "btrfs snapshots" to the Grub menu.
### Description:
Improves grub by adding "btrfs snapshots" to the grub menu.

You can boot your system on a "snapshot" from the Grub menu.
You can boot your system on a "snapshot" from the grub menu.
Supports manual snapshots, snapper, timeshift ...

##### Warning: booting on read-only snapshots can be tricky
Expand All @@ -22,16 +22,16 @@ This project includes its own solution.
Refer to the [documentation](https://github.com/Antynea/grub-btrfs/blob/master/initramfs/readme.md).

- - -
### What does grub-btrfs v4.xx do :
* Automatically List snapshots existing on root partition (btrfs).
* Automatically Detect if "/boot" is in separate partition.
* Automatically Detect kernel, initramfs and intel/amd microcode in "/boot" directory on snapshots.
* Automatically Create corresponding "menuentry" in `grub.cfg`
### What features does grub-btrfs v4.xx have?
* Automatically list snapshots existing on root partition (btrfs).
* Automatically detect if `/boot` is in separate partition.
* Automatically detect kernel, initramfs and intel/amd microcode in `/boot` directory on snapshots.
* Automatically create corresponding "menuentry" in `grub.cfg`
* Automatically detect the type/tags and descriptions/comments of snapper/timeshift snapshots.
* Automatically generate `grub.cfg` if you use the provided systemd service.

- - -
### Installation :
### Installation:
#### Arch Linux
The package is available in the community repository [grub-btrfs](https://archlinux.org/packages/community/any/grub-btrfs/)
```
Expand Down Expand Up @@ -60,58 +60,64 @@ Now merge grub-btrfs via
* [gawk ](https://archlinux.org/packages/core/x86_64/gawk/)

#### NOTE: All distros
Generate your Grub menu after installation for the changes to take effect.
Generate your grub menu after installation for the changes to take effect.
For example:
On **Arch Linux** or **Gentoo** use `grub-mkconfig -o /boot/grub/grub.cfg`.
On **Fedora** use `grub2-mkconfig -o /boot/grub2/grub.cfg`
On **Debian-like** distribution `update-grub` is an alias to `grub-mkconfig ...`
- - -
### Customization :
### Customization:

You have the possibility to modify many parameters in `/etc/default/grub-btrfs/config`.
See [config file](https://github.com/Antynea/grub-btrfs/blob/master/config) for more information.

- - -
### Automatically update grub :
#### Systemd
1. If you would like grub-btrfs menu to automatically update when a snapshot is created or deleted:
* Use `systemctl enable grub-btrfs.path`.
* `grub-btrfs.path` automatically (re)generates `grub-btrfs.cfg` when a modification appears in `/.snapshots` mount point (by default).
* If the `/.snapshots` mount point is already mounted, then use `systemctl start grub-btrfs.path` to start monitoring.
Otherwise, the unit will automatically start monitoring when the mount point will be available.
* If your snapshots location aren't mounted in `/.snapshots`, you must modify `grub-btrfs.path` unit using
`systemctl edit --full grub-btrfs.path` and run `systemctl reenable grub-btrfs.path` for changes take effect.
To find out the name of the `.mount` unit
use `systemctl list-units -t mount`.
* For example: Timeshift mounts its snapshot folder in `/run/timeshift/backup/timeshift-btrfs/snapshots`.

Use `systemctl edit --full grub-btrfs.path`.
Then replace the whole block by:
```
[Unit]
Description=Monitors for new snapshots
DefaultDependencies=no
Requires=run-timeshift-backup.mount
After=run-timeshift-backup.mount
BindsTo=run-timeshift-backup.mount

[Path]
PathModified=/run/timeshift/backup/timeshift-btrfs/snapshots

[Install]
WantedBy=run-timeshift-backup.mount
```
Then save and finally run `systemctl reenable grub-btrfs.path` for changes take effect.
Optional:
If the `/run/timeshift/backup/timeshift-btrfs/snapshots` mount point is already mounted,
then use `systemctl start grub-btrfs.path` to start monitoring.
Otherwise, the unit will automatically start monitoring when the mount point will be available.
* You can view your change to `systemctl cat grub-btrfs.path`.
* To revert change use `systemctl revert grub-btrfs.path`.

2. If you would like grub-btrfs menu to automatically update on system restart/ shutdown:
### Automatically update grub upon snapshot:
To automatically regenerate `grub-btrfs.cfg` when a modification appears in the `/.snapshots` mount point, run
```bash
systemctl enable grub-btrfs.path
systemctl start grub-btrfs.path # In case the mount point is available already
```
Monitoring starts automatically when the mount point becomes available.

#### Snapshots not in `/.snapshots`
To modify `grub-btrfs.path` run
```bash
systemctl edit --full grub-btrfs.path
systemctl reenable grub-btrfs.path
```
To find out the name of the `.mount` unit use `systemctl list-units -t mount`.

**Timeshift**
1. Run `systemctl edit --full grub-btrfs.path`
1. Replace the whole block by:
```
[Unit]
Description=Monitors for new snapshots
DefaultDependencies=no
Requires=run-timeshift-backup.mount
After=run-timeshift-backup.mount
BindsTo=run-timeshift-backup.mount

[Path]
PathModified=/run/timeshift/backup/timeshift-btrfs/snapshots

[Install]
WantedBy=run-timeshift-backup.mount
```
1. Run `systemctl reenable grub-btrfs.path` to reload the changes you made

1. Run `systemctl start grub-btrfs.path` to start monitoring.<br>Otherwise, the unit will automatically start monitoring when the mount point will be available.

Note:
You can view your change to `systemctl cat grub-btrfs.path`.
To revert change use `systemctl revert grub-btrfs.path`.

----
### Automatically update grub upon restart/boot:
[Look at this comment](https://github.com/Antynea/grub-btrfs/issues/138#issuecomment-766918328)
Currently not implemented

##
#### OpenRC
1. If you would like grub-btrfs menu to automatically update when a snapshot is created or deleted:
Expand All @@ -123,7 +129,7 @@ Currently not implemented

2. If you would like grub-btrfs menu to automatically update on system restart/ shutdown:
Just add the following script as `/etc/local.d/grub-btrfs-update.stop`
```
```bash
#!/bin/bash

description="Update the grub btrfs snapshots menu"
Expand All @@ -143,7 +149,7 @@ Just add the following script as `/etc/local.d/grub-btrfs-update.stop`
If you want to run the menu update on startup instead, rename the file to `grub-btrfs-update.start`
* Works for snapper and timeshift

##### Warning :
##### Warning:
by default, `grub-mkconfig` command is used.
Might be `grub2-mkconfig` on some systems (Fedora ...).
Edit `GRUB_BTRFS_MKCONFIG` variable in `/etc/default/grub-btrfs/config` file to reflect this.
Expand Down