Vm secondary root (/) extension in lxd


I created lxd vm and successfully expanded the size of root (/) to 20GB.
Also, I tried to expand root (/) to 40GB due to insufficient space, and the following error message appears.

What can I do to solve the problem?
(Creating a storage pool and extending the root (/) in the new storage pool will solve the problem?)

You can increase the size of an existing root device using:

lxc config device set <instance> root size=40GB

If the root disk is part of a profile and not directly part of the instance then you can copy the profile’s root disk device into the instance and modify its size property in one step using:

lxc config device override <instance> root size=40GB

Note, if this is a VM you will also need to enlarge the partition and resize the filesystem inside the VM.

Thank tomp.
I solved the problem well as you told me.

  1. You mean “existing root device”, which means that the root device file exists on / dev, right?

  2. When I first expanded the root size, I used the “lxc config device add” command, and it was successfully expanded. Is the extension method wrong?

  3. Can I set “quouta” for the storage volume?

By “existing” I meant that the root device exists in the instance’s config (rather than the profile config applied to this instance).

You can see an instance’s config (without applying the profile config) by running:

lxc config show <instance>

And with profile config applied:

lxc config show <instance> --expanded

If the root device wasn’t existing in the non-expanded instance config then you would not be able to modify it using set, as it doesn’t exist yet.

Using lxc config device add is fine to use, the override option is just a shorthand that will effectively do an add using the existing options from the profile and then overriding the specific key(s) you specify.

The end result is that the instance has a root device in its own config.

I’m not sure what you mean by quota in the context of VMs. They use fixed size volumes so the VMs cannot grow beyond that size (effectively they all have a fixed quota of their VM root size).


The meaning of the quota I am talking about is as follows.

The size of root (/) appearing in “df -h” after creating a container seems to be the size of the root specified when running lxd init.

When creating a container, I want to determine the size of root (/).

When creating a container on a storage pool that doesn’t use block devices for volumes (i.e not lvm, and ceph) then there is no default quota applied, and you’re only limited by the size of the underlying storage pool.

Thank you very much.^^
Your teaching very helpful to me.