Using the most current version of LXD on Ubuntu Focal, I’d like to change the location images are stored. Because if I use lxc image import I run out of space, the root drive has limited capacity, by default.
How do I change the default image storage location, or at least specify a different location for a one-time import? All storage pools are dir based.
You can create a storage volume on one of your pools with lxc storage volume create and then assign that volume to hold the image files with lxc config set storage.images_volume POOLNAME/VOLUMENAME
After I used this advice to create a temporary volume to store test images, I later removed this storage volume, and then lxd refused to start with error "level=error msg="Failed to start the daemon" err="Failed to mount images storage: Storage pool not found" on next reboot.
Finally sudo sqlite3 /var/snap/lxd/common/lxd/database/local.db 'delete from config where key="storage.images_volume"' saved me and the server restarted… Perhaps this error message should be enhanced.
I remember that I wasn’t exactly in clean lab conditions: so I created this volume with btrfs, but it was too small, so I tried to extend it, messed up with the volume, deleted the volume in a dirty way, then waited one good week before rebooting and facing the issue on reboot - meanwhile I had totally forgotten about adding that volume and defining it as storage.images_volume…
No software will ever manage to avoid all stupid user errors, but having a message storage.images_volume xyz not found - reverting to default would have been helpful.
Anyway this message will perhaps save someone’s night in the future, so it’s probably enough like this - I guess there are many more important issues !!