Move source of btrfs storage pool

I have a btrfs storage pool on a loop-backed btrfs filesystem and I need to change the mount point of the btrfs filesystem. I currently have the filesystem mounted to /opt/xd/storage/default and I want to move it to /lxd/storage/default. I tried lxc storage set default source /lxd/storage/default but I get Error: The [source] properties cannot be changed for "btrfs" storage pools. Anyone know how I can go about doing this?

If you’ve already done the move, you can do a one time database modification like:

  • lxd sql global “UPDATE storage_pools_config SET key=’/lxd/storage/default’ WHERE source=’/old/path’;”
  • systemctl reload snap.lxd.daemon

This is not really recommended but for your particular use case, will be perfectly fine.

Normally storage changes are recommended to be done by defining a new storage pool, then moving containers and volumes, then deleting the old storage pool in LXD.

That gave me an error: Error: Failed to exec query: no such column: source

I ended up remounting it in the original location and moving the container to a new storage pool.

Oh sorry, the query was wrong, you want:

lxd sql global “UPDATE storage_pools_config SET value=’/lxd/storage/default’ WHERE value=’/old/path’;”

That’s what I get for answering forum questions from my phone when at a busy conference :slight_smile: