https://raspberrypi.stackexchange.com/questions/8265/btrfs-root-filesystem-on-raspbian
sudo apt install btrfs-progs initramfs-tools
'btrfs' | sudo tee -a /etc/initramfs-tools/modules
sudo mkdir -p /etc/initramfs-tools/hooks ; sudo mkdir -p /etc/initramfs-tools/scripts/local-premount ; sudo cp /usr/share/initramfs-tools/hooks/btrfs /etc/initramfs-tools/hooks ; sudo cp /usr/share/initramfs-tools/scripts/local-premount/btrfs /etc/initramfs-tools/scripts/local-premount; sudo chmod +x /etc/initramfs-tools/hooks/btrfs /etc/initramfs-tools/scripts/local-premount/btrfs
https://forums.raspberrypi.com/viewtopic.php?t=10532&sid=506b6601ef85b73e2e6cafc95f4636c6&start=50
Do this (as root where # is shown):
sudo apt-get install initramfs-tools busybox-static
sudo echo "BUSYBOX=y" >>/etc/initramfs-tools/conf.d/local
sudo echo "initramfs initrd.img-$(uname -r) followkernel" >>/boot/config.txt
#4. add your custom boot actions to /etc/initramfs/scripts/local-top/local.sh (or other script directory)
# mkinitramfs -v -o "/boot/initrd.img-$(uname -r)"
update-initramfs -v -c -k $(uname -r)
# reboot
after reboot
dmesg | grep -i btrfs
config explanations - https://www.raspberrypi.com/documentation/computers/config_txt.html#initramfs
Edit /etc/default/raspberrypi-kernel
and uncomment INITRD=Yes
rm /etc/kernel/postinst.d/initramfs-tools
curl -o /etc/kernel/postinst.d/rpi-initramfs-tools -L https://raw.githubusercontent.com/Piskvor/custom-rpi-initramfs/master/etc/kernel/postinst.d/rpi-initramfs-tools
chmod +x /etc/kernel/postinst.d/rpi-initramfs-tools
Here https://raspberrypi.stackexchange.com/questions/8265/btrfs-root-filesystem-on-raspbian Or here https://feldspaten.org/2019/07/05/raspbian-and-btrfs/
fdisk -l /dev/mmcblk0
# ....
# /dev/mmcblk0p2 540672 15659007 15118336 **7.2G** 83 Linux
# on another pc
btrfs-convert /dev/sdaX
# cd mounted disk and fix fstab
btrfs subvolume list .
cd /media/tomfun/rootfs/etc/
We need to tell the RPi that it's going to boot from btrfs
sudo blkid
/dev/sda2: LABEL="rootfs" UUID="0504d1df-68c1-43a7-b635-a886558abfcf" UUID_SUB="b32a47b6-0f49-4b14-b7ca-2467d082b3a5" BLOCK_SIZE="4096" TYPE="btrfs" PARTUUID="499e5770-02"
/dev/sda1: LABEL_FATBOOT="boot" LABEL="boot" UUID="0F92-BECC" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="499e5770-01"
get UUID (not UUID_SUB, not PARTUUID): 0504d1df-68c1-43a7-b635-a886558abfcf
nano fstab
cd
umount /media/tomfun/rootfs
PARTUUID=499e5770-01 / btrfs defaults,subvol=/,noatime 0 1
nano /media/tomfun/boot/cmdline.txt
or where is boot mounted
Find these two parameters
root=PARTUUID=1234-5678 rootfstype=ext4
And replace with
root=UUID=0504d1df-68c1-43a7-b635-a886558abfcf rootfstype=btrfs