increase lxd storage pool

lxd 存储池扩容

lxd 5.13版本之后,添加了存储池扩容支持

1
lxc storage set <pool_name> size=<new_size>

比如为default存储器扩容

1
lxc storage set default size=400GB

这只适用于lxd管理的loop-back存储池,而且只能增大存储池,而不能缩小它。(This will only work for loop-backed storage pools that are managed by LXD. You can only grow the pool (increase its size), not shrink it.)

5.13以前的版本可以这样扩容:

1
2
3
sudo truncate -c -s +100G /var/snap/lxd/common/lxd/disks/default.img
sudo btrfs filesystem resize max /var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/default
Resize '/var/snap/lxd/common/mntns/var/snap/lxd/common/lxd/storage-pools/default' of 'max'

References:

[1]Resize a storage pool

[2]Resize underlying btrfs storage

[3]Increase the LXD/LXC Btrfs loop file storage pool size