In order to determine the size of a LXC container, first run lxc storage list
to list your storage pools:
[email protected]:~$ lxc storage list +---------+-------------+--------+------------------------------------+---------+ | NAME | DESCRIPTION | DRIVER | SOURCE | USED BY | +---------+-------------+--------+------------------------------------+---------+ | default | | dir | /var/lib/lxd/storage-pools/default | 2 | +---------+-------------+--------+------------------------------------+---------+
If the driver
is not dir
, you are using a COW-type storage backend. Using this technology it is not possible to easily determine the storage size of a container. The following instructions apply only for the dir
driver.
Now open a root shell and cd
to the directory listed in the SOURCE
column and cd
to its containers
subdirectory:
[email protected] ~ # cd /var/lib/lxd/storage-pools/default [email protected] /var/lib/lxd/storage-pools/default # cd containers/ [email protected] /var/lib/lxd/storage-pools/default/containers #
This directory contains the storage directory for all containers. Run du -sh *
in order to find the size of each container:
[email protected] /var/lib/lxd/storage-pools/default/containers # du -sh * 2.0G my-container
In this example, the container my-container
occupies 2.0 Gibibytes of disk space.