我的 Debian Bullseye 盒子上有 btrfs 文件系统,并且我设置了 btrfs 来制作系统快照。最近,我更改了一些破坏我的肉桂桌面的东西,我想从最后一个已知的工作快照中恢复。
一些背景:
$ sudo snapper --version
snapper 0.8.14
flags btrfs,lvm,no-ext4,xattrs,rollback,btrfs-quota,no-selinux
$ cat /etc/fstab
UUID="12345678-1337-c0d3-1111-deadbeef0abc" /boot btrfs rw,noatime,nodiratime,subvol=@boot_debian 02
UUID="12345678-1337-c0d3-1111-deadbeef1abc" / btrfs rw,noatime,nodiratime,subvol=@root_debian 01
UUID="12345678-1337-c0d3-1111-deadbeef1abc" /.snapshots btrfs rw,noatime,nodiratime,subvol=@root_debian/.snapshots 0 1
$ sudo btrfs subvolume list /
ID 256 gen 6 top level 5 path @
ID 257 gen 59305 top level 5 path @root_debian
ID 258 gen 8 top level 5 path @root_kali
ID 362 gen 59301 top level 257 path .snapshots
ID 363 gen 53701 top level 362 path .snapshots/1/snapshot
ID 365 gen 53800 top level 362 path .snapshots/2/snapshot
ID 380 gen 54783 top level 362 path .snapshots/13/snapshot
ID 382 gen 54810 top level 362 path .snapshots/14/snapshot
[...]
ID 465 gen 59247 top level 362 path .snapshots/84/snapshot
ID 466 gen 59301 top level 362 path .snapshots/85/snapshot
$ sudo snapper list
# | Type | Pre # | Date | User | Cleanup | Description | Userdata
----+--------+-------+---------------------------------+------+----------+------------------------+--------------
0 | single | | | root | | current |
1 | single | | Sat 19 Dec 2020 02:16:27 PM CET | root | | Fingerprint working. |
2 | single | | Sat 19 Dec 2020 03:00:04 PM CET | root | timeline | timeline |
13 | single | | Sun 20 Dec 2020 10:16:35 AM CET | root | timeline | timeline |
14 | pre | | Sun 20 Dec 2020 10:23:36 AM CET | root | number | apt |
15 | post | 14 | Sun 20 Dec 2020 10:23:56 AM CET | root | number | apt |
16 | pre | | Sun 20 Dec 2020 10:58:37 AM CET | root | number | apt |
17 | post | 16 | Sun 20 Dec 2020 10:58:57 AM CET | root | number | apt |
[...]
57 | pre | | Tue 22 Dec 2020 08:29:33 PM CET | root | number | apt |
58 | post | 57 | Tue 22 Dec 2020 08:29:37 PM CET | root | number | apt |
59 | single | | Wed 23 Dec 2020 04:54:59 PM CET | root | timeline | timeline |
60 | single | | Wed 23 Dec 2020 05:00:00 PM CET | root | timeline | timeline |
61 | pre | | Wed 23 Dec 2020 05:01:06 PM CET | root | number | apt |
62 | post | 61 | Wed 23 Dec 2020 05:02:48 PM CET | root | number | apt |
63 | single | | Wed 23 Dec 2020 05:18:54 PM CET | root | number | boot |
64 | pre | | Wed 23 Dec 2020 05:24:14 PM CET | root | number | apt |
65 | post | 64 | Wed 23 Dec 2020 05:24:20 PM CET | root | number | apt |
66 | pre | | Wed 23 Dec 2020 05:24:26 PM CET | root | number | apt |
67 | post | 66 | Wed 23 Dec 2020 05:24:29 PM CET | root | number | apt |
68 | single | | Wed 23 Dec 2020 05:28:00 PM CET | root | number | boot |
69 | single | | Wed 23 Dec 2020 05:47:26 PM CET | root | number | boot |
70 | single | | Wed 23 Dec 2020 06:00:02 PM CET | root | timeline | timeline |
71 | pre | | Wed 23 Dec 2020 06:05:08 PM CET | root | number | apt |
72 | post | 71 | Wed 23 Dec 2020 06:05:14 PM CET | root | number | apt |
73 | pre | | Wed 23 Dec 2020 06:26:24 PM CET | root | number | apt |
74 | post | 73 | Wed 23 Dec 2020 06:26:28 PM CET | root | number | apt |
75 | single | | Wed 23 Dec 2020 06:59:10 PM CET | root | number | boot |
76 | single | | Wed 23 Dec 2020 07:01:38 PM CET | root | number | boot |
77 | single | | Wed 23 Dec 2020 07:26:49 PM CET | root | number | boot |
81 | single | | Wed 23 Dec 2020 07:30:08 PM CET | root | | writable copy of #58 |
82 | single | | Wed 23 Dec 2020 07:39:01 PM CET | root | number | rollback backup of #57 | important=yes
83+ | single | | Wed 23 Dec 2020 07:39:01 PM CET | root | | writable copy of #57 |
84 | single | | Wed 23 Dec 2020 07:41:19 PM CET | root | number | boot |
85 | single | | Wed 23 Dec 2020 08:00:11 PM CET | root | timeline | timeline |
rootflags=subvol=@root_debian
我的 grub 条目默认启动。我想替换@root_debian
为snapshot 58
.我怎么做?谢谢!
答案1
您可能想要启动到 Live CD。从那里,您可以操作 btrfs 子卷以将 @root_debian 替换为目标快照:
# mount <yourDefaultBtrfsSubVolume> /mnt
# btrfs subvol snapshot /mnt/@root_debian/.snapshots/58/snapshot /mnt/@root_debian
另外,如果您选择:
$ sudo snapper rollback 83
正如您在评论中所述,您可能只需要刷新 grub 安装,如下所示:https://wiki.archlinux.org/index.php/User:I2Oc9/Root_on_Btrfs_with_LUKS_full_disk_encryption#Rollback_root_filesystem