Hi, I tried to setup a new LXD server and one of the first steps is to create a storage pool. I’m using LVM elsewhere on this server and I’m most familiar with it as a tool for portioning out disk space. So I tried to create a new LXD pool as follows:
However, this appears not to respect the “size” flag and instead generates a new thinpool which takes over the whole volume group! Is this expected? (Other storage drivers appear to respect the size flag?)
It appears that you can work around this using something like the following procedure:
Figure out how much free space there is:
vgdisplay vg_slow
Figure out how large you want the thinpool to be and subtract that from the free space
Allocate a temporary lv which fills up the the remaining space computed as above
Create the new thinpool, which will fill up the whole vg
Erase the temporary lv, this leaves the thinpool at the desired size
This is obviously error prone and long winded, so it would be desirable to be able to specify the size of the thinvolume at creation and have that respected
Note that it’s simple to grow/extend the size of a thinpool to use MORE space and this can be done online. However, a current limitation of lvm thinpools is that they cannot be shrunk (at all), only grown. This obviously interacts badly with the current situation where lxd grabs all of the space, as it cannot be shrunk later.
Normally size on the pool is only used when creating loop-backed pools, but in the scenario you describe it makes sense for the lvm driver to only create a logical volume of the specified size in the volume group for use as the thinpool.