# Changing the data partition to btrfs

**URL:** <https://hub.mender.io/t/changing-the-data-partition-to-btrfs/394>\
**Category:** General Discussions\
**Tags:** yocto, thud\
**Created:** [March 19, 2019, 10:54pm UTC](https://hub.mender.io/t/changing-the-data-partition-to-btrfs/394 "2019-03-19T22:54:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimFroehlich](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/timfroehlich/32/164_2.png) [@TimFroehlich](https://hub.mender.io/u/TimFroehlich)\
**Post date:** [March 19, 2019, 10:54pm UTC](https://hub.mender.io/t/changing-the-data-partition-to-btrfs/394/1 "2019-03-19T22:54:05Z")

</div>

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: [https://github.com/mendersoftware/meta-mender/pull/705](https://github.com/mendersoftware/meta-mender/pull/705)

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [March 20, 2019, 8:58am UTC](https://hub.mender.io/t/changing-the-data-partition-to-btrfs/394/2 "2019-03-20T08:58:26Z")

</div>

Expect comments on the PR
