SD full of old images/containers

Hi,

While our newer devices are running on balenaCloud, some of our early devices are using OpenBalena and running 2.48.0+rev1.

In some of the devices we see the SD filling up - and these are 64GB SD cards, so should have plenty of free space.

After researching it we found that /mnt/data/docker/overlay2 folder is 39GB in size :exploding_head:

The folder has 282 subfolders, many of which are >100M in size.

Looking into these folders looks like the file system of the containers… with the /usr folder being the largest folder.

Note that we have 3 containers + supervisor.

We tried to run ‘balena system prune -f -a’ but it only removed one file and rerunning it did not clean up anything else.

Here is a sample of the 10 largest folders in overlay2:
439M 723d35f2ee10b14e224c1c0e6460988cdca006b5644d7a693d6cf611b592cd71
450M 0b638dbe8dae35eb579b551915bf53640e65630e27c540b7d1c504e81e4599e3
453M 47743fbfc24b5a6c64c75b5c5cd8a5fdde1d00a26c997acc7748be3754cbf1b8
461M ff6aafaeab05922a00feff6b866a81c9f290d049839032784009e41bd74795fd
571M e177b34b322bd90d0272b00d8d99de3119a676b6753883cf126f67445800befa
594M 3b6385d335fce05ed52e049edae3364f50c4eb30805c19209b2f7499146f5522
601M 0ff596897e1e7d1668476eb38bfae7e91d08c0ff9276761b3f6b2a10f60b9a75
722M 23e432e9da0292a9b76f6a225f0e46dd7c09385023cbfcedb575ce64a414cb75
730M eaa806cd363c020cb888287d7b0d3b7bf90506812cd087b83af2cb1c9352711d
753M 66f694a8ddb2221de413f9334841ebf92f200f9b6e54c55ad303a4f6cd510ddb

Any recommendations of how to clean this up without interfering with the device? (it is being used by a customer)

Thank you :wink:

Thanks @n42 for reaching out with your query. The overlay folder is sensitive, given the filesystem layer. This post explains it better, and I would not suggest deleting individual /overlay2 folder. Ref: Is it safe to clean docker/overlay2/ - Stack Overflow

We do have some steps to reclaim memory; listed here: Balena Device Debugging Masterclass - Balena Documentation
See if any of the above helps relieve some of the memory pressure.

Also, I would suggest looking to update to latest version of the OS (as an example if you have RaspB devices the OS versions are at >= 2.80.8+rev2. Let us know how it goes.

Regards,
N