Changing the data partition to btrfs

So my devices will basically be bricked if certain files get corrupted (wifi config, etc) so I’m moving towards RO rootfs and as hardened a data partition as I can get. I’m on a raspberrypi with an SD Card so the best I can figure (currently) is btrfs with dup for data and metadata, mounted with commit set to 0. I’m certainly happy to hear better options but that’s where I am now and I’m working on implementation.

Right now the Mender layer is geared towards everything being the same partition type with the same generation options and mount options. Plus, it seems to be made for ext 3/4, for example, the IMAGE_CMD_dataimg function uses the force and root directory flags from mkfs.ext4.

Right now I’m thinking of co-opting the MENDER_DATA_PART_FSTYPE variable. I’d leave it’s default to auto, but allow it to be set to btrfs, which would trigger btrfs-tools-native:do_populate_sysroot and things like that. I’m also adding MENDER_DATA_PART_FSTAB_OPTS and …FSOPTS, so that my filesystem opts can be set in wic and IMAGE_CMD_dataimg, and my mount options can be set in the fstab.

Are there any problems with my approach? I can probably post a patch sometime tonight.

Edit: Draft posted here:

Expect comments on the PR

1 Like