BTRFS restoring doesn't work

Hi you all!
I need help, i’ve installed fedora 35 with btrfs after updating to 37 i’ve also installed new version of timeshift and found that i can make only rsync bakup. To fix this i followed instruction at A quick guide to setting up BTRFS Timeshift on Fedora 33

after that i have these:

$ sudo lsblk
loop0    7:0    0 181.9M  1 loop /var/lib/snapd/snap/postman/179
loop1    7:1    0  55.5M  1 loop /var/lib/snapd/snap/core18/2409
loop2    7:2    0    47M  1 loop /var/lib/snapd/snap/snapd/16010
sda      8:0    0 931.5G  0 disk 
├─sda2   8:2    0   340G  0 part 
└─sda3   8:3    0   591G  0 part 
sdb      8:16   0 111.8G  0 disk 
├─sdb1   8:17   0   600M  0 part /boot/efi
├─sdb2   8:18   0     1G  0 part /boot
└─sdb3   8:19   0 110.2G  0 part /home
zram0  252:0    0   6.7G  0 disk [SWAP]
$ sudo blkid
/dev/loop1: TYPE="squashfs"
/dev/sdb2: UUID="84f170e2-9c0b-4a6d-b2d9-75b84f7e3522" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="9562a047-b328-478d-bf62-de784b575a0a"
/dev/sdb3: LABEL="fedora_localhost-live" UUID="d07eea42-8da3-4271-819f-6ba8fedd30d5" UUID_SUB="47e9db54-295c-4a15-b9ae-3e2483688eec" BLOCK_SIZE="4096" TYPE="btrfs" PARTUUID="bacd1c2d-722c-46ff-97fa-242e1df8d33c"
/dev/sdb1: UUID="2384-6038" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="4cc6079f-f824-418a-b53c-8985dd3cae33"
/dev/loop2: TYPE="squashfs"
/dev/loop0: TYPE="squashfs"
/dev/sda2: LABEL="Data" BLOCK_SIZE="512" UUID="8AD8BD88D8BD72D5" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="eaec4419-c71b-4f14-9fa8-0adc03eb63e1"
/dev/sda3: UUID="98bb953e-0f6a-42b8-a324-52b50c01e798" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="974fb685-0c0d-8e4f-bb47-6898dd890a83"
/dev/zram0: LABEL="zram0" UUID="a03c49ce-0140-4859-a9a5-90421c79a137" TYPE="swap"

and this

# /etc/fstab
# Created by anaconda on Sun Jan 16 02:06:15 2022
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
UUID=d07eea42-8da3-4271-819f-6ba8fedd30d5 /                       btrfs   subvol=@,compress=zstd:1 0 0
UUID=84f170e2-9c0b-4a6d-b2d9-75b84f7e3522 /boot                   ext4    defaults        1 2
UUID=2384-6038          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=d07eea42-8da3-4271-819f-6ba8fedd30d5 /home                   btrfs   subvol=@home,compress=zstd:1 0 0

I can make BTRFS snapshots, but cannot restore snapshot from timeshift (deleted files hasnt recover). Also at grub I see snapshots, that i cannot find anywhere.

The only way I see is reinstall

Can you be more specific about what you mean by you “cannot restore snapshot from timeshift”?

As a side note, timeshift’s btrfs support isn’t very good to being with.

I mean, that if I have deleted a file (in downloads for example) and I see it in backup with browsing manually, so after me restoring snapshot the file is still deleted.

You could try a restore using the cli interface and see if you get any errors that way.

1 Like

Thanks for your help!

I’ve just found that files are restored (but after some of time).
So after restoring files are still deleted, but after a while they are.

creating snapshot and restoring complete very fast (less then a minute), but result of restoring shows itself after a while.
its very strange…

So I have still a problem with grub it show restore points, that I don’t have (for example, all of my snapshots had made at Ferdora 37, but on loading I see restore point from Fedora 35)

Just to be clear, you are rebooting after restoring, correct? Restoring a snapshot without rebooting would be not ideal if it is moving the snapshots around to do the restore. The mounted filesystem would still be the old filesystem in that case.

You need to use something to ensure that the grub menu is being rebuilt when you take snapshots. I think grub-btrfs ships with a service for that now.

not exactly, this time i suspend my notebook for a day or two. And now, then I took it, I see restored files

Thanks! I shall read about it.

You definitely should. Always reboot after a snapshot restore.

Resuming from suspend must have caused the subvol to be remounted.

However, it is still bad. It means everything you did between restoring the snapshot and restoring from suspend is basically gone now.

Today is not my day…

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found Fedora Linux 37 (Workstation Edition) on /dev/sdb3
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
/etc/grub.d/41_snapshots-btrfs: line 569: /boot/grub/ No such file or directory
You don’t reinstall grub2 on uefi the way you did in Fedora.

Doesn’t it has to be installed with Fedora by default (out of box I mean)?

I think that comment is off the mark.
By default grub is installed with fedora, and the document linked simply shows how to recover if the system is hosed and a recovery is needed.

That document has nothing to do with what happens with btrfs or snapshots as it is related to grub and the OS only.

News of my problems: I reinstall grub 2 and broke it. I have black screen with grub recover. Started from live usb and chroot to mounted system. Now when i’m trying to install grub (as step of Bootloading with GRUB2 :: Fedora Docs) i have this:

# sudo grub2-install /dev/sdb
grub2-install: error: /usr/lib/grub/x86_64-efi/ doesn't exist. Please specify --target or --directory.
# ls /usr/lib/grub
arm64-efi  i386-pc

UPD. Fixed by installing package, now this is a problem:

# sudo grub2-install /dev/sdb
grub2-install: error: this utility cannot be used for EFI platforms because it does not support UEFI Secure Boot.

and still a problem:

# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Generating grub configuration file ...
Found Fedora Linux 37 (Workstation Edition) on /dev/sdb3
Adding boot menu entry for UEFI Firmware Settings ...
Detecting snapshots ...
/etc/grub.d/41_snapshots-btrfs: line 569: /boot/grub/ No such file or directory

UPD. 2 fix snapshots folder at /etc/default/grub-btrfs/config

Do not mix instructions for BIOS and UEFI, specifically step #7.

thanks to you very much) Спасибо!!!
You just saved me an hour of my life with this easy tip)

As a result my problems are resolved now!

Another problem is that you should update only /boot/grub2/grub.cfg and never touch /boot/efi/EFI/fedora/grub.cfg.
If your system is configured to boot with UEFI, then you need to restore the default config by reinstalling the package grub2-common.

Official instruction at Bootloading with GRUB2 :: Fedora Docs contains # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg at step 8.

Also GRUB 2 - Fedora Project Wiki tell us # rm /boot/efi/EFI/fedora/grub.cfg (but forgot about configure new one)

By the way my initial problem has been correlated with this step, namely irrelevant snapshots at grub. One mistake in configuring Grub-btrfs made all of this painful investigation

Be careful to not mix the LVM and Btrfs instructions.
The Btrfs steps are fine, but the LVM steps are outdated due to a certain change.
After the chroot command, both LVM and Btrfs instructions should be the same.
I actively use LVM and can confirm this issue.

@vgaetera If you are interesting my grub 2 uses /boot/efi/EFI/fedora/grub.cfg against /boot/grub2/grub.cfg and IDK why