LXD Change Storage Location


(Tatrasiel R) #1

Good day,

I have volumes that are being stored in
lxc storage list
default | | btrfs | /var/snap/lxd/common/lxd/disks/default.img

Since I am running out of space , I want to move them to
/mnt/Storage1

I read this ( below ) but the answer isn’t 100% clear to me. I read online several things but it seems that LXD has made many changes in the past few years.

Let me know please ,

Currently I am thinking on making a sim-link to the mounted drive, but eventually I will have two or three drives. I though I would ask before doing something potentially breaking to my environment.

Thanks as always Steven


(Stéphane Graber) #2

So one option is indeed to bind-mount /mnt/Storage1 onto /var/snap/lxd/common/lxd/disks and move the default.img over to that new drive.

Another, usually more reliable, option is to add your other drive (or one of its partition) to LXD directly as a storage pool, avoiding the whole loop file trick.

Say you made a partition at /dev/sdb1 that you want LXD to use for storage using btrfs, you can do:

lxc storage create sdb1 btrfs source=/dev/sdb1

And you’ll get a new pool called sdb1 which can host container, images and custom storage volumes. You can also then move containers and custom volumes over to that pool, even to the point where you empty your old pool and can delete it.


(Tatrasiel R) #3

Hey Stgraber, sorry for the delay. I will try this out and let you know the results.

looking from the answer it should satisfy the demand.

Thank you