btrfs has some nice features. That's why it makes sense to convert the root filesystem of a Raspberry running RaspbianOS from ext4 to btrfs.
Note: The following instructions require basic Linux knowledge because it's just a memory aid for me and the instructions are not very detailed.
Prerequisites
- A running RaspbianOS which uses ext4 for the root filesystem
- A second SD card the same OS
- Update the system
sudo apt-get update sudo apt-get upgrade - Install required tools
sudo apt-get install btrfs-tools initramfs-tools - Add btrfs to initramfs modules
echo 'btrfs' | sudo tee -a /etc/initramfs-tools/modules - Initramfs updaten
sudo update-initramfs -c -k $(uname -r) - Reboot und check dass btrfs unterstützt wird
dmesg | grep -i btrfs - Optional: Backup your system
- Boot the seconds RaspbianOS with the same kernel level and attach the SD card with the system to convert
- Check filesystem for errors
sudo fsck.ext4 /dev/
<zu konvertierende partition> - Convert the ext4 filesystem to btrfs
sudo btrfs-convert /dev/<zu konvertierende partition> - Update
cmdline.txtwith the UUID of the new root filesystem and update the filesystem used from ext4 to btrfs. Use follwoing command to retrieve the required informatio
lsblk -fs
-
Update
/etc/fstabwith zje UUIDs of the boot and root partition and update the filesystem used from ext4 to btrfs - Boot the converted system and enjoy the btrfs features
References
btrfs rootfilesystem on Raspberry
How to install Raspberry pi OS on a btrfs SSD driver?

