Antynea / grub-btrfs

Include btrfs snapshots at boot options. (Grub menu)
GNU General Public License v3.0
688 stars 73 forks source link

Updated root directory "/" to btrfs RAID1 and new snapshots are not being detected #323

Closed K-J-VV closed 3 months ago

K-J-VV commented 4 months ago

When I initially installed grub-btrfs, my system was a single SSD and root was located at /dev/mapper/VG1-LV1. I've since added a new drive and converted the root directory "/" to RAID1, so now my systems root is referenced by UUID=abcd-1234

I've updated my fstab to reference this UUID for mounting and am able to use my system without problems, reboot, take snapshots, etc., no problems at all. However, since changing to RAID1 these new snapshots aren't detected by grub-btrfs.

Is there some config somewhere that I must edit with the new UUID of my root "/" directory? I'm not quite sure what the problem may be, but think it may be that grub-btrfs is referencing the old mount of /dev/mapper

Schievel1 commented 4 months ago

My guess is than something along those lines is not working: https://github.com/Antynea/grub-btrfs/blob/346a9868b83f283bd96dc4f38232e24f7b7b630c/41_snapshots-btrfs#L113 (this and the following lines that probe the root device) Can you execute them as root manually and see if there is a problem?

What grub-btrfs does is just executing btrfs subvolume list / and parsing the snapshots from this output. Does this give back a valid subvolume list?

K-J-VV commented 4 months ago

@Schievel1

It is still detecting subvolumes as follows:

ID 256 gen 537 top level 5 path @ ID 257 gen 152 top level 5 path @snapshots ID 258 gen 172 top level 5 path @home ID 259 gen 520 top level 5 path @log ID 260 gen 476 top level 5 path @cache ID 261 gen 111 top level 5 path @crash ID 262 gen 476 top level 5 path @tmp ID 263 gen 111 top level 5 path @spool ID 264 gen 111 top level 5 path @images ID 265 gen 111 top level 5 path @containers ID 266 gen 111 top level 5 path @docker ID 268 gen 123 top level 257 path @snapshots/1/snapshot ID 269 gen 123 top level 257 path @snapshots/2/snapshot ID 270 gen 151 top level 257 path @snapshots/3/snapshot

Note: snapshots 1 and 2 existed before RAID1 conversion and snapshot 3 is taken immediately after

The output of ' sudo /etc/grub.d/41_snapshots-btrfs ' is just:

Detecting snapshots ...

My guess is than something along those lines is not working: https://github.com/Antynea/grub-btrfs/blob/346a9868b83f283bd96dc4f38232e24f7b7b630c/41_snapshots-btrfs#L113 (this and the following lines that probe the root device) Can you execute them as root manually and see if there is a problem?

Sorry if I'm missing something, but is there another command you are asking me to run as root? I'm novice and can understand what that code is looking for but a bit unsure how to translate those lines into commands. I've tried a few things but no luck, may require a bit of explicit guidance to troubleshoot

K-J-VV commented 4 months ago

probing root device displays both of the drives used for the RAID1

/dev/mapper/VG0 /dev/mapper/VG1

Schievel1 commented 3 months ago

I just merged a PR that fixes problems with RAID, can you try if this also fixes it for you?

K-J-VV commented 3 months ago

I just merged a PR that fixes problems with RAID, can you try if this also fixes it for you?

FYI before this update, I was able to just go to the file mentioned above and replace the /dev/mapper with UUID and things worked

Just so happens that I decided to nuke my server and start from scratch again, everything is working great! No need for me to edit anything this time

Thank you!