我尝试安装timeshift
,但找不到我的子卷,因为它们没有以“@”命名:
sudo btrfs sub list /
ID 256 gen 18303 top level 5 path root
ID 257 gen 18303 top level 5 path home
sudo btrfs filesystem show
Label: 'fedora_localhost-live' uuid: b4af3fb7-bd48-4d59-96c0-0a71385a8fb8
Total devices 1 FS bytes used 60.93GiB
devid 1 size 236.89GiB used 67.02GiB path /dev/nvme0n1p3
我想我需要重命名它们,一些用户建议使用mv
(但如何?)并更新 GRUB,但我是新手btrfs
,我不知道应该运行什么命令以及应该编辑哪些文件而不会破坏整个系统
我的 /etc/fstab/
UUID=b4af3fb7-bd48-4d59-96c0-0a71385a8fb8 / btrfs subvol=root,compress=zstd:1 0 0
UUID=52ff126f-6a73-41df-9312-15d2ae1fbf91 /boot ext4 defaults 1 2
UUID=3D19-2F96 /boot/efi vfat umask=0077,shortname=winnt 0 2
UUID=b4af3fb7-bd48-4d59-96c0-0a71385a8fb8 /home btrfs subvol=home,compress=zstd:1 0 0
答案1
感谢 Google Groups 上 @piorunz 的回答,我修复了我的分区:https://groups.google.com/g/linux.debian.user/c/4Qg3Fxv_pHo
1. Find out what is the path to your root partition. You can use:
$ lsblk | grep "part /"
├─nvme0n1p1 259:1 0 512M 0 part /boot/efi
├─nvme0n1p2 259:2 0 37.3G 0 part /
└─nvme0n1p3 259:3 0 172G 0 part /mnt/ssd
So in my case / is on nvme0n1p2. Therefore, full path is /dev/nvme0n1p2.
Note that.
2. Boot to Linux USB stick. I used Linux Mint.
3. mount your / partition and navigate to it in terminal
4. Change btrfs subvolume name using sudo mv, in my example:
sudo mv @rootfs @
5. Edit /etc/fstab on your root partition, to tell it new name of
subvolume, like so: subvol=@, full line example here:
UUID=77ba5989-5d64-4929-9145-ede6751a4102 /
btrfs
noatime,nodiratime,space_cache=v2,ssd,compress-force=zstd:6,subvol=@ 0 1
6. sync && sudo reboot, remove USB stick
7. You will be greeted by grub emergency console of your system, as grub
don't know yet where is root partition now. Boot to your Linux using
following commands in grub console:
ls - use that to find where your root partition is in grub nomenclature.
You can do things like ls, then ls (hd5,gpt2)/@/ to browse contents to
btrfs partition to eventually find your root. Note that my root is on
(hd5,gpt2), which is similar to /dev/nvme0n1p2 (partition2 = gpt2).
Once you have your grub partition number, do:
set root=(hd5,gpt2)
linux /@/boot/vmlinuz/5.10.0-9-amd64 root=dev/nvme0n1p2 rootflags=subvol=@
initrd /@/boot/initrd.img-5.10.0-9-amd64
boot
As you see, set root=(hd5,gpt2) uses grub nomenclature and
root=dev/nvme0n1p2 uses normal nomenclature from lsblk.
8. So you are logged in to your system as normal. Generate new grub
config and install it into place:
sudo grub-mkconfig -o /boot/grub/grub.cfg
9. Reboot, grub will load as normal and you are fully in @ btrfs
subvolume and can use Timeshift now. Profit!
如果您在第 7 步遇到困难,请检查您的默认 grub 选项并将 root 更改为@
。
如果在步骤 8 中遇到问题,请运行:
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
sudo grub2-mkconfig -o /etc/grub2-efi.cfg
sudo grub2-mkconfig -o /etc/grub2.cfg