[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SOLVED] Change root subvolume on btrfs



Finally I have managed to do that!

Steps:

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!

--
With kindest regards, Piotr.

⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀


Reply to: