Btrfs storage How do I add or remove devices?

As installing docker in containers using zfs is problematic I thought I’d create a btrfs storage.
That all works fine however if I want to add or remove a device from btrfs how do that within the LXD storage context?.

The issue is that created my btrfs storage from a single partition…
#lxc storage create btrfs btrfs source=/dev/ubuntu-vg/lxd-btrfs-0-lv

I’ve created a second btrfs partition and I’ld like to add it to the first…

From a CLI point of view I’d expect todo…
btrfs device add /dev/mapper/ubuntu–vg-lxd–btrfs–1--lv /mnt

But of course I’ve not for this partition mounted… So how do I tell lxd to use both for this storage?

Thanks in advance

You can actually do that with btrfs just fine but you’ll need to first mount it somewhere you can see it.

Try:

  • mount /dev/ubuntu-vg/lxd-btrfs-0-lv /mnt
  • btrfs device add /dev/ubuntu-vg-lxd-btrfs-1-lv /mnt
  • umount /mnt
1 Like

Thanks for that… Do you think it does any harm to leave it mounted?

Nope, the kernel treats additional mounts of a given block device as effectively bind-mounts, so no harm in keeping those around.

Brilliant thanks… I’ll add a mount into my next update…