How to convert raspberry pi 4 to btrfs?

I followed the nixos wiki to install rpi4 about a year ago, which pointed me to this website to install the image.
It is the image with nixos preinstalled with ext4 filesystem.

I am happy with that until recently the nixos-rebuild switch keep failing, and it is caused by all the 8GB ram filled up with 3 build jobs, and there is no swap partition on the disk.

I want to change the filesystem to btrfs and then add a swap subvolume to update the machine. How can I do that? Thanks!

Swap won’t really help with builds like that. What you can do is limit the max-jobs/max-cores if it’s failing at the build stage, if it’s at the eval stage then I’d say use another machine to build the config and deploy it to the rpi.

1 Like

I have just tried --cores 1 but it still build with 4 cores.
The --max-job flag? Thank, I will give it a try

found this page explain both options: Tuning Cores and Jobs - Nix Reference Manual

It now build slowly without crash, thank you for your help!