Install DietPi with btrfs as root file system

I’ve been using armbian with my rock64 for a few years.
it has been running well. However, due to power cut issue, the boot partition got corrupted a couple times.
I used backup before, but this time I forgot to backup for a while, and now I can’t boot from the memory card anymore.
tried to recover it, but no idea what I should do.

It seems I needed a reinstall.
Since I was going to reinstall, I decided to try DietPi now.

And also wanted to use btrfs as file system, so that it has better resilience against power cut issue for the future.

I have been reading docs for couple days, I found I can edit /boot/dietpi.txt file to customize installation.
However, I couldn’t figure out where to change partition types or filesystem settings.
Can anyone please help regarding this?
I found rootfstype=ext4 in dietpiEnv.txt file.
tried changing it to rootfstype=btrfs
it didn’t boot and showed incorrect mounting option error.

also, couldn’t find any doc that explains all the options in these txt files.

How do I use btrfs as file system? Is ext4 the only option?
Any other better suggestion?
Can anyone please help me regarding all of these?
Any input is greatly appreciated.

Thanks.

Every option in this file has comments to explain what it is doing.

1 Like

Something you can’t change. All our images are ext4 by default. Theoretically the image would need to be created with btrfs from scratch. Not sure if our build system is supporting it.

I guess @MichaIng knows

1 Like

sorry, the options in dietpi.txt are explained.
When I wrote the above, I had dietpiEnv.txt in mind.
I worded it poorly.
I guess I’m not supposed to be editing that file?

oh I see.
ext4 is the only option I guess?

For default images yes.

Usually you can add overlays and some configurations. Armbian should have a similar file

1 Like

is it possible to build myself?
is there any doc or wiki available for that?

Overall, do you recommend btrfs?

I don’t want to reinstall in the case of data corruption.
what do you recomend?

If you have different Debian base running on btrfs, you could try our conversation script Supported hardware - DietPi.com Docs

Personally i run all my installation on default ext4.

2 Likes

Have a look at this link, it covers the most common ways to harden ext4 against power loss.
For starters, check the mount options in /etc/fstab and change the lazytime option to sync.
https://serverfault.com/questions/356507/safe-ext4-configuration-for-systems-running-unattended

1 Like