That’s perfect! Thank you so much!
Going over these recent posts, I get the impression that your method might be preferable if the user makes several snapshots (scheduled and/or on-demand) during the same session. At shutdown they will be added to the Grub boot menu and the older ones will be deleted if there are more than 15 snapshots.
In my case, I make on-demand snapshots once in while so perhaps the grub-btrfs.service is preferable.
It’s nice to finally have a easy solution for grub-btrfs thanks to @Antynea , but you’re right, in my personal usecase I think sticking to my shutdown method uses slightly less system resources.
I just came across btrfs-scrub@.timer
by chance running the following command to see the systemd services that are present but disabled on my system:
systemctl list-unit-files --state disabled --no-pager
Should I enable the timer?
btrfs scrub is used to scrub a btrfs filesystem, which will read all data and metadata blocks from all devices and verify checksums. Automatically repair corrupted blocks if there’s a correct copy available.
The user is supposed to run it manually or via a periodic system service. The recommended period is a month but could be less.
https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrub
Mines disabled too with @2000 wiki setup. Not sure… still don’t understand a lot about the setup. But i can say what i do know! It works flawlessly! So i’m trying not to wreck it!
I guess “pebcak” is getting restless, looking for some action
Running a monthly btrfs-scrub is recommended and won’t wreck your setup .
You can activate the systemd timer to scrub / monthly with
systemctl enable --now btrfs-scrub@-.timer
Some options:
- Run the timer manually
systemctl start btrfs-scrub@-
- or manually run a scrub on /
sudo btrfs scrub start /
- Check the status of a (running) scrub
sudo btrfs scrub status /
- Cancel a running scrub
sudo btrfs scrub cancel /
Note: A scrub can take a long time to run, so that cancel command could come in handy should you need to get serious work done.
sudo systemctl enable --now btrfs-scrub@-.timer
Created symlink /etc/systemd/system/timers.target.wants/btrfs-scrub@-.timer → /usr/lib/systemd/system/btrfs-scrub@.timer.
$ systemctl status btrfs-scrub@-.timer
● btrfs-scrub@-.timer - Monthly Btrfs scrub on /
Loaded: loaded (/usr/lib/systemd/system/btrfs-scrub@.timer; enabled; vendor preset: disabled)
Active: active (waiting) since Wed 2020-10-14 18:51:43 CEST; 9s ago
Trigger: Thu 2020-11-05 21:08:05 CET; 3 weeks 1 days left
Triggers: ● btrfs-scrub@-.serviceOct 14 18:51:43 eos-gnome systemd[1]: Started Monthly Btrfs scrub on /.
sudo btrfs scrub status /
UUID: 635a0671-ab15-4fda-bb4f-281ba5d59fa6
Scrub started: Wed Oct 14 19:04:43 2020
Status: finished
Duration: 0:00:05
Total to scrub: 11.94GiB
Rate: 2.39GiB/s
Error summary: no errors found
$ sudo btrfs scrub start /Data
scrub started on /Data, fsid 777ace92-81f4-44e0-b91b-f2ff42480739 (pid=22337)$ sudo btrfs scrub status /Data
UUID: 777ace92-81f4-44e0-b91b-f2ff42480739
Scrub started: Wed Oct 14 18:53:13 2020
Status: finished
Duration: 0:00:11
Total to scrub: 30.24GiB
Rate: 2.75GiB/s
Error summary: no errors found
Is it alright to modify
/usr/lib/systemd/system/btrfs-scrub@.service
[Unit]
Description=Btrfs scrub on %f[Service]
Nice=19
IOSchedulingClass=idle
KillSignal=SIGINT
ExecStart=/usr/bin/btrfs scrub start -B %f
to include another file system mounted at /Data ?
Mine took a little longer!
[ricklinux@eos-plasma ~]$ sudo btrfs scrub status /
[sudo] password for ricklinux:
UUID: 8cf978c4-050c-4011-aada-aff2066b2654
Scrub started: Wed Oct 14 13:00:17 2020
Status: finished
Duration: 0:09:25
Total to scrub: 203.80GiB
Rate: 369.33MiB/s
Error summary: no errors found
[ricklinux@eos-plasma ~]$
Yours:
Mine:
But also
Yours
Mine:
Ya i don’t know why yours is rate so high? Mine is on the SSD which is way slower than m.2
I kind of suspected also that the rate might depend on the type of the disk. Mine is a m.2 PCIe NVMe Gen 3 x4
.
I will try it on my two other installs that are on m.2 disks. One is encrypted.
You can modify the original service unit but keep in mind that a future pacman update, although the chance being slim, could revert your changes.
To make permanent changes to unit files you have several options: See the ArchWiki on how to edit unit files.
Yes much faster on my m.2 drives
[ricklinux@eos-xfce ~]$ sudo btrfs scrub status /
[sudo] password for ricklinux:
UUID: a83de6a5-d5d0-4b96-89dd-8785ede9f1df
Scrub started: Wed Oct 14 13:59:28 2020
Status: finished
Duration: 0:00:47
Total to scrub: 132.62GiB
Rate: 2.84GiB/s
Error summary: no errors found
[ricklinux@eos-xfce ~]$
Just in case
@2000
I was just curious about the above os-prober-btrfs package. Currently i have 3 btrfs installs all on different drives and one is encrypted two are not. These are installed via the wiki instructions and a little help from you. I am using rEFInd and when it boot’s it loads from rEFInd icon which then loads grub menu. Each desktop currently is self contained in that it doesn’t add the other desktop installs to the grub menu. I don’t know the reason exactly. Is it because i only have os-prober installed and not the btrfs version? So it doesn’t see the btrfs file system? Or is it because of the way you have it set up? Or because of rEFInd? I like it this way as i don’t have to have multiple entries in the grub menu showing the other installs. The only reason os-prober is there is to find the other os installed? So my question is if i installed os-prober-btrfs instead of os-prober is it going to find the other installs and add them to the grub menus in each install. Or just totally screw up what i have working here?
Tough question. It will probably locate them, and add them to the grub of the system it is run from. The problem is, the entries will probably still be incorrect (the -ucode.img problem) of any arch-based distros - except possibly Manjaro (if that’s where it came from). I don’t think I would mess with it - unless you just wish to experiment - and I would limit the experiment to just one distro (after making a backup of your current /boot/grub/grub.cfg), and check the generated /boot/grub/grub.cfg carefully for information purposes - and then restore the one you have in use now…
I really like the way it is set up now because what difference does it make having all the entries in the grub menu? I still have to restart it anyway and i would have to make a selection in the grub menu. The way i have it now i only have to make one selection in rEFInd unless of course i decide to have more than one kernel installed or the lts kernel. Then i would have to choose in the grub menu when it comes up. I was just curious because i’m not sure if it’s the setup or os-prober doesn’t see the btrfs file system so it doesn’t add them?