Koops
Koops

Reputation: 543

How to resize an ubuntu LXC LXD container

Are you exploring the world of Docker and coding on your Ubuntu desktop? It's common to feel a bit hesitant about making changes, but don't worry, I've got you covered! If you've encountered space issues while experimenting with Docker, I'll walk you through the process of resizing your Ubuntu lxc image, so you can continue your Docker adventures with ease.

Upvotes: 1

Views: 1369

Answers (1)

Koops
Koops

Reputation: 543

To resize your lxc containers, you have to resize the pool in which they live.

First stop all your containers:

sudo lxc stop --all

Find the name of the profile your containers are using:

sudo lxc profile list

After getting a list choose the name of the pool your containers are in:

lxc profile show <profile name // usually called "default">

Look at the current storage:

lxc storage info <pool name // usually called "my pool">

Now edit the file containing the storage size:

lxc storage edit <pool name>

Now edit the file containing the storage size:

config:
  size: 50GB
  source: /var/snap/lxd/common/lxd/disks/mypool.img
  zfs.pool_name: mypool
description: ""
name: mypool

Check the new storage:

lxc storage info <pool name>

Check lxc container storage

lxc exec <container name> -- sudo -i
df -h

Upvotes: 2

Related Questions