0

I'm trying to use LXD to test Ansible deployments, but the container are too small. I read the documentation from linuxcontainers.org here, and I still cannot increase the size on the root disk of my LXD container :

I'm running these versions :

lsb_release -a                                                                                             [15:07:41]
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:    22.04
Codename:   jammy

lxd --version                                                                                              [15:07:23]
5.8

zfs --version                                                                                              [15:07:35]
zfs-2.1.4-0ubuntu0.1
zfs-kmod-2.1.4-0ubuntu0.1

Before :

On the container :

root@node4:~# df -h
Filesystem                Size  Used Avail Use% Mounted on
default/containers/node4  2.6G  2.4G  267M  90% /
none                      492K  4.0K  488K   1% /dev
udev                      7.7G     0  7.7G   0% /dev/tty
tmpfs                     100K     0  100K   0% /dev/lxd
tmpfs                     100K     0  100K   0% /dev/.lxd-mounts
tmpfs                     7.7G     0  7.7G   0% /dev/shm
tmpfs                     1.6G  208K  1.6G   1% /run
tmpfs                     5.0M     0  5.0M   0% /run/lock
snapfuse                   92M   92M     0 100% /snap/lxd/23991
snapfuse                   64M   64M     0 100% /snap/core20/1695
snapfuse                   92M   92M     0 100% /snap/lxd/24061
snapfuse                   50M   50M     0 100% /snap/snapd/17883

On the host :

root:~/ # zpool list                                                                                                                                                               [14:53:08]
NAME      SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
default  24.5G  9.74G  14.8G        -         -    12%    39%  1.00x    ONLINE  -

What I tried

sudo truncate -s +5G <LXD_lib_dir>/disks/<pool_name>.img
sudo zpool set autoexpand=on <pool_name>
sudo zpool online -e <pool_name> <device_ID>
sudo zpool set autoexpand=off <pool_name>

The ZFS pool was increased, but the default/containers/node4 disk on the container was not increased. I tried to restart the container, I created new container but the volume does not show 24.5G available.

lxc profile show default                                                                                                                                                 [14:26:01]
config: {}
description: Default LXD profile
devices:
  eth0:
    name: eth0
    network: lxdbr1
    type: nic
  root:
    path: /
    pool: default
    size: 20GB
    type: disk
name: default
used_by:
- /1.0/instances/node1
- /1.0/instances/node2
- /1.0/instances/node3
- /1.0/instances/node6
- /1.0/instances/node5
- /1.0/instances/node4
Jean
  • 123
  • 8

0 Answers0