Public bug reported: A default ubuntu container created using "lxc-create -n ubuntu -t ubuntu" results in 386M space used on /var/lib/lxc/ubuntu/rootfs. A big part of that space is used by cached debs on /var/lib/lxc/ubuntu/rootfs/var/cache/apt/archives/ . Running "apt-get clean" inside the container's rootfs reduced space usage to 242M.
The wasted space becomes even more apparent if the backing store supports compression (e.g. zfsonlinux with gzip compression enabled). In this case the original used space (after compression) was 196M, and was reduced to 95M after the cached package files are removed, over 50% disk space saving. Suggestion: Modify lxc-ubuntu template to run "apt-get clean" inside the container's rootfs as part of container creation process. # lsb_release -rd Description: Ubuntu 12.04.1 LTS Release: 12.04 # apt-cache policy lxc lxc: Installed: 0.7.5-3ubuntu62 Candidate: 0.7.5-3ubuntu62 Version table: *** 0.7.5-3ubuntu62 0 500 http://archive.ubuntu.com/ubuntu/ precise-updates/universe amd64 Packages 100 /var/lib/dpkg/status 0.7.5-3ubuntu52 0 500 http://archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages Expected result: "lxc-create -t ubuntu" result in a container which uses disk space efficiently Actual result: "lxc-create -t ubuntu" result in a container which uses more disk space than it should ** Affects: lxc (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Server Team, which is subscribed to lxc in Ubuntu. https://bugs.launchpad.net/bugs/1037626 Title: lxc-create wastes disk space by keeping installation debs To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1037626/+subscriptions -- Ubuntu-server-bugs mailing list Ubuntu-server-bugs@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs