Sources (March 2025):
- https://www.youtube.com/watch?v=o-3_ZlvsZAI (grub for ext4 @ ~1h24)
- https://btrfs.readthedocs.io/en/latest/Compression.html
- https://btrfs.readthedocs.io/en/latest/btrfs-device.html
- https://www.lorenzobettini.it/2022/10/timeshift-and-grub-btrfs-in-ubuntu/
Important
these steps worked for me! your milage may vary!
remember that these steps could lead to an UNBOOTABLE system or to DATALOSS.
take nessesary precaution and backups!
- create a backup of the disc with
dd - convert the ext4 volume into a new btrfs volume
sudo btrfs-convert <DISK>- mount the new volume and navigate into it.
sudo mount -o subvol=@ /dev/sdxY /mnt- create a new btrfs sub volume
sudo btrfs subvol create @Important
For Timeshift to work the root subvolume must be named @.
(optional) More Subvolumes can be created like @home, @cache and so on.
- move
/into the new subvolume.- (the error, that @ cannot be moved into itself can be ignored)
sudo mv * @/mount the root partition
sudo mount -o subvol=@ /dev/sdxY /mntmount the boot partition
sudo mount /dev/sdzY /mnt/bootmount the efi partition (UEFI Boot)
sudo mount /dev/sdwY /mnt/boot/efimount system
for dir in /dev /dev/pts /proc /sys /run; do sudo mount --bind $dir /mnt$dir; donechroot into the installation
sudo chroot /mnt /bin/bash- set UUID of the new disc
- type von
ext4zubtrfsändern. - set these options:
defaults,noatime,space_cache=v2,compress=zstd:3,subvol=@
- defrag the btrfs filesystem and compress it:
sudo btrfs fi defragment / -r -czstdImportant
the root partition is now compressed. To mount it in the future use:
sudo mount -o subvol=@ -o compress=zstd /dev/sdxY /mntwhen chroot'ed into the system it should be enough to just update the grub config:
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo update-grubotherwise try:
edit the file `/boot/efi/EFI/ubuntu/grub.cfg
- set the new UUID of the Root-Partition
- update the path with the prefix
/@
update the grub launcher directly:
- File location:
/boot/grub/grub.cfg - search for
submenu- old value:
/boot/vmlinuz... - new value:
/@/boot/vmlinuz... - update the UUID
- add
rootflags=subvol=@afterro
- old value:
- if a swap-partition and the file
/etc/initramfs-tools/conf.d/resumeexists, update the UUID inside this file. - install btrfs-progs if not already present:
sudo apt install btrfs-progs - finally
sudo update-initramfs -u
now reboot