Lxd expand default storage

From UVOO Tech Wiki
Jump to navigation Jump to search

https://discuss.linuxcontainers.org/t/how-to-resize-zfs-used-in-lxd/1333/9

Assumptions: 1) One zfs pool called ‘default’ that lives on the hard drive at /var/lib/lxd/disks/default.img. 2) Running as root. 3) Growing pool ‘default’ from 25GB to 45GB.

Stop all running containers.
#truncate -s +20G /var/lib/lxd/disks/default.img
#zpool set autoexpand=on default
#zpool status -vg default
4a. Note the device id value from the results (for me, it was a really long number). You’ll need it in the next step.
#zpool online -e default device_id_from_step_4a
#zpool set autoexpand=off default
#service lxd restart
7a. This is on Debian/Ubuntu. For CentOS, it’d be a “systemctl” command.
After service restart, if you do a “$lxc storage info default”, you should now see the expanded space. Restart containers.