I’ve noticed a massive growth within the Docker Overlay directory (/var/lib/docker/overlay/), its currently at about 22GB in size. Regarding to “docker ps -s” there are only 3 active containers running on my system.
I have tried already “docker system prune -a -f” in order to free up some disk space, but this seems to have no effect at all.
So I’m wondering what is the right approach with UCS to keep this directory maintained and free up disk space again? Some hints or instructions would be much appreciated.
as directories from /var/lib/docker/overlay itself are mounted underneath /var/lib/docker/overlay, did you add the -x parameter to du? E.g. du -shx /var/lib/docker/overlay instead of just du -sh /var/lib/docker/overlay? Might give a wrong impression on how much space is really used by counting files more than once if -x wasn’t used.
du -shx /var/lib/docker/overlay gives me:
4,0G /var/lib/docker/overlay
As UCS is running here in a virtual machine (Hyper-V), I have noticed first that there is a rapid growing of the according vhdx-file.Trying to find out what is eating up the disk space I ran “df -h”, whitch gave me:
what’s mounted on the /var/lib/docker/overlay mount point is the root file system (device /dev/mapper/vg_ucs-root). Therefore the 22GB used space are across your whole root device — which isn’t all that unusual.
If you’re curious where all the space is used, I highly suggest you try the ncdu utility (you’ll have to enable the unmaintained repository before you can install it). It’s an ncurses-based, interactive tool for digging into space usage on a file system. Run it like this:
AFAIR vhdx files do not perfectly shrink when you delete files from the underlying filesystem, so if you perform a lot of filesystem operations in the virtual machine the vhdx file will continue to grow.
thx for your feedback, I found this out too in the meanwhile, but running “compress” vhdx-file from the Hyper-V manager does not show much effect. I seems in order to get a good result (compression) it is required to “zero out” the unused blocks on the file system first. I don’t have a clue how to achieve this with UCS.
/edit: Sorry, I just saw that this thread is already quite old.
Hey, in case you are comfortable with the command line you can simply create files that contain only zeros, for example:
dd if=/dev/zero of=./testfile bs=1024 count=1024
This reads from /dev/zero, outputs to a file named testfile in the local directory. The blocksize is 1024 (if you need huge files try to increase this value to some multiple of 1024) and count is 1024, so in this case you write a file with 1048576 bytes. Increase the count value to the filesize you want. Leave some disk space unused, otherwise your system may crash/stop, especially when running this command as root. Do not forget to remove the temporary file afterwards.