如何查找 lxc 容器的大小
为了确定 LXC 容器的大小,首先运行 lxc storage list 列出你的存储池:
lxc_storage_list.sh
uli@myserver:~$ lxc storage list
+---------+-------------+--------+------------------------------------+---------+
| NAME | DESCRIPTION | DRIVER | SOURCE | USED BY |
+---------+-------------+--------+------------------------------------+---------+
| default | | dir | /var/lib/lxd/storage-pools/default | 2 |
+---------+-------------+--------+------------------------------------+---------+如果 driver 不是 dir,你正在使用 COW 类型存储后端。使用此技术无法轻松确定容器的存储大小。以下说明仅适用于 dir 驱动程序。
现在打开 root shell 并 cd 到 SOURCE 列中列出的目录,然后 cd 到其 containers 子目录:
cd_to_containers.sh
root@myserver ~ # cd /var/lib/lxd/storage-pools/default
root@myserver /var/lib/lxd/storage-pools/default # cd containers/
root@myserver /var/lib/lxd/storage-pools/default/containers #此目录包含所有容器的存储目录。运行 du -sh * 查找每个容器的大小:
du_containers.sh
root@myserver /var/lib/lxd/storage-pools/default/containers # du -sh *
2.0G my-container在此示例中,容器 my-container 占用 2.0 Gibibytes 的磁盘空间。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow