Root '/' on Btrfs USB storage, how?


What is the correct way to set up Manjaro-ARM to run with root ‘/’ on USB memory storage whilst /boot remains on the SD-card?

A post in the ArchLinuxARM forum implies that the new way is to edit /boot/boot.txt instead of the old way of using /boot/cmdline.txt.

Looking at the first few lines of boot.txt it appears I need to modify the file and then run mkscr:

# After modifying, run ./mkscr

# Set root partition to the second partition of boot device
part uuid ${devtype} ${devnum}:2 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"

but I am not clear on what I need to change, could someone give me some guidance and an example please?

In my case I have a WD PiDrive HDD with a partition for swap and a BTRFS formatted partition with two subvolumes called @ for the root / directory and @home for /home.


I think @GrayJack was setting something like this up at some point, or was that with both /boot and / on the USB?


It was both on /boot and / on the USB

Not only there, but on fstab too, probably


Thank you for responding.

Thanks, I had already prepared fstab on the USB device, but it is boot.txt on which I am unclear.

If it were cmdline.txt that was being used I think it would include:
root=UUID=9c3bf7ec-cea7-4934-9b6c-810ff706ee08 rootfstype=btrfs rootflags=subvol=@
but how should that information be entered into boot.txt?

(This is my very first venture into using Manjaro ARM on a Raspberry Pi 3B so I am a novice in that respect, I am otherwise a regular user but not an expert of Manjaro.)


As an experimental educated guess I modified the first few lines of boot.txt to be as follows:

# After modifying, run ./mkscr

# Set root partition to the second partition of boot device
# part uuid ${devtype} ${devnum}:2 uuid

# This is the PARTUUID:

# root '/' is on the third partition of the USB device
part uuid ${devtype} ${devnum}:3 uuid

setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=${uuid} rw rootwait smsc95xx.macaddr="${usbethaddr}"  rootfstype=btrfs  rootflags=subvol=@

I then ran ./mkscr as advised and rebooted the Raspberry Pi. Here are the last few lines displayed on the screen:

:: mounting '/dev/disk/by-partuuid/3a039c27-55e2-9e4e-b33d-bcb8f05c0b47'
mount: /new_root: unknown filesystem type 'btrfs'
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned off
[rootfs ]#

It appears to have tried to access the correct root partition but encountered unknown filesystem type 'btrfs' problem, hence a couple of questions:

  • Is this because there is no BTRFS support in the kernel until it would be added after booting?
  • Is there anything one can add to boot.txt to add support for booting with root on a BTRFS partition?



I don’t think the ARM kernels support BTRFS…


I don’t have access to an Manajro ARM, but on Arch Linux ARM

# modinfo btrfs
filename:       /lib/modules/4.19.5-1-ARCH/kernel/fs/btrfs/btrfs.ko.gz
license:        GPL
alias:          devname:btrfs-control
alias:          char-major-10-234
alias:          fs-btrfs
depends:        zstd_compress,zstd_decompress,raid6_pq,xor
intree:         Y
name:           btrfs
vermagic:       4.19.5-1-ARCH SMP mod_unload aarch64

and I can mount and access a external btrfs drive.


I guess it’s just a question about loading the module then.


Maybe try to add btrfs in the modules array in mkinitcpio.conf and rebuild the initramfs? I’m not sure about the dependencies of the btrfs module. Maybe add them to the array as well.

Just noticed, there is even a btrfs hook for mkinitcpio. Maybe it is enough to add this hook to your Hooks array.


Not at all an ARM expert, but

I think the zstd modules are only needed when effectively using compression (or lz4 lz4_compress for LZ4 comp).
The hook seems to be only necessary when using multi-device btrfs root, but it certainly won’t hurt adding it.


Well this is encouraging, adding btrfs to the MODULES section in mkinitcpio.conf appears to be a solution:

# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(piix ide_disk reiserfs)

The system booted with root ‘/’ on the Btrfs partition of the USB storage device, relevant lines from the mount command show that to be the case:

/dev/sda3 on / type btrfs (rw,relatime,lazytime,nossd,space_cache,autodefrag,subvolid=257,subvol=/@)
/dev/sda3 on /home type btrfs (rw,relatime,lazytime,nossd,space_cache,autodefrag,subvolid=258,subvol=/@home)

In summary this was my process:

  1. Boot a fresh intall of Manjaro ARM from the SD-card.
  2. Edit mkinitcpio.conf to add btrfs to the MODULES section.
  3. Use sudo blkid to obtain the PARTUUID of the Btrfs partition on the USB storage device.
  4. Edit boot.txt, as I described in my earlier post above, then run ./mkscr.
  5. Perform the system updates pacman -Syyuu. (I presume if this did not include kernel updates I would also need to run mkinitcpio -p linux).
  6. Poweroff.
  7. On another computer copy the SD-card root ‘/’ directory to the new root Btrfs subvolume on the the USB storage device.
  8. Edit the new fstab to mount the new root subvolume on ‘/’ along with any other mounts required.
  9. Put the SD-card back in the Raspberry Pi (or whatever) attach the USB storage and reboot the system. It should now use root on the Btrfs subvolume of the USB storage device.

I hope that is correct and that it may be of help to others.
My thanks to those who helped me get this working.


Very nice!