btrfs filesystem instead of ext4

I am using 3.8.13-bone28 Beaglebone Black. In order to have faster operation, I am looking to switch root partition to btrfs i.e. mmcblk0p2 as below:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT mmcblk0 179:0 0 7.5G 0 disk ├─mmcblk0p1 179:1 0 48M 0 part /boot/uboot └─mmcblk0p2 179:2 0 3.3G 0 part /

Having gone through the thread: https://groups.google.com/forum/#!searchin/beagleboard/btrfs|sort:date/beagleboard/R8nlIwEYFfM/mdYBADymAAAJ , it seems like there has been recent enabling of BBB support for btrfs filesystem. However, I was wondering if this support is only applied to 4.x.x kernel or would it also work with the kernel I am using? If so, is it as simple as just changing mmcrootfstype=btrfs rootwait in uEnv.txt?

Thanks!

I am using 3.8.13-bone28 Beaglebone Black. In order to have faster
operation, I am looking to switch root partition to btrfs i.e. mmcblk0p2 as
below:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 7.5G 0 disk
├─mmcblk0p1 179:1 0 48M 0 part /boot/uboot
└─mmcblk0p2 179:2 0 3.3G 0 part /

faster operation where is that stated? Depending on how old your
"distro" is, btrfs can be slower. (apt will be slow, dpkg sync calls)

I'm looking at is for it's native compression, and the possibility of
improved reliability over ext4 in systems where power get's yanked.

Having gone through the thread:
Redirecting to Google Groups
, it seems like there has been recent enabling of BBB support for btrfs
filesystem.

Right now, all "buster-iot" images are btrfs by default on the weekly builds..

However, I was wondering if this support is only applied to
4.x.x kernel or would it also work with the kernel I am using?

3.8.x had it enabled:

CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set

If so, is it
as simple as just changing mmcrootfstype=btrfs rootwait in uEnv.txt?

Nope.. There's a few more things you have to do manually...

Just grab a newer weekly snapshot, don't waste time trying to directly
convert that old image your running.

Regards,

That is very informative Nelson. Thank you.

I tried with a new snapshot and it works very well. Alongside that, I am curious and would like to learn about the BBB conversion from ext4 to flash filesystem. Are there any documentation/manual online that could explain/hint/guide through the filesystem conversion from ext4 to flash filesystem like btrfs?

Thanks,

It's worth pointing out that btrfs is not a flash filesystem, it needs a
FTL (Flash Transition Layer) to do wear levelling on a NAND flash the
same as EXT4 does.

Your biggest hurdle is the fact that U-Boot does not understand btrfs,
so you'll need a /boot partition formatted EXT4. Not sure that this is
likely to change, as porting btrfs to U-Boot could be a major
undertaking as it's much more complex.

BTRFS environment file storage, once a filesystem driver is ported,
should be an easy undertaking… least I didn't find getting U-Boot to
support EXT4 for environment file storage particularly hard as there was
an example for FAT as a starting point.

Actually U-Boot has btrfs support as of v2018.01 (even ZLIB
compression! lzo is broken).

We got a patch merged in v2018.03-rc1 that fixes (lzo compression..)

Regards,

if you want to give it a go, use this base image:

https://rcn-ee.net/rootfs/bb.org/testing/2018-01-28/buster-iot/bone-debian-buster-iot-armhf-2018-01-28-4gb.img.xz

it's one partition btrfs.

Regards,

Ohh brilliant… I was in the process of porting some of my U-boot patches
for another platform over to the latest release (they were built atop a
2014 release), but hadn't gotten around to actually playing with it.

Does this include the U-Boot environment as well?

CONFIG_FS_BTRFS=y
CONFIG_CMD_BTRFS=y

It's build off of the generic commands: CONFIG_CMD_FS_GENERIC so you
can use the generic "load" commands..

I did have to get a little creative as the load command uses ext
first, and so it would annoying print out this non-error:

diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index dac9545365..a8e6fdef51 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -2378,7 +2378,7 @@ int ext4fs_mount(unsigned part_length)

  return 1;
fail:
- printf("Failed to mount ext2 filesystem...\n");
+ //printf("Failed to mount ext2 filesystem...\n");
  free(data);
  ext4fs_root = NULL;

Regards,

There are definitely still problems with btrfs compression and uboot. If I take this image, update /etc/fstab to add compress=zlib, reboot to remount, and then run “btrfs fi defrag -c -r /” to compress the full filesystem, then it refuses to boot. All I see on the console is “starting the kernel” and then nothing. All the usr lights come on full and it sits there.

I’m still experimenting a bit. I think an attribute can be added to the /boot directory to have it not compress stuff in /boot. I want to see if that helps at all.

Dan