CRC Housekeeping

CRC provides the ability to develop Openshift applications locally, without relying on a heavyweight infrastructure or a cloud environment. But developers will soon realise that multiple deployments will leave traces, and these will turn the system unstable. In other words, you might get  the infamous error message: Diskpreassure. You could reinstall CRC; it is in fact very simple. But nobody wants to recreate all those secrets and config maps. Fortunately, you have a second option: CRC Housekeeping.

Before we start let us see how we got into this situation. First connect via ssh to your system:

and the run a ‘df -h’ to check the filesystem.

Disk space on the Openshift imageSysroot is the drive where the image registry is located and most of the artifacts are stored. Our main goal is to try to free up some space from “/sysroot” by using the tools provided by crc.

1-Pruning the deployments

Our first task is to recover space used by deployments that are no longer being used:

Without the ‘–confirm’ flag, the execution will be a dry run. In other words, it will be a test to see if it works and nothing will be really deleted. If you are happy with the test result, add the ‘–confirm’ flag to  prune the components definitely.

2- Pruning the builds

Very similar als the one above, but this time you recover the space used by building the components. It will also execute a dry run if you don’t use the confirm flag.

3- Pruning the images

This is the one that will recover the most space because it is similar to the docker purge command. As with the ones above, it will execute as a dry run if you omit the confirm flag:

Once you are ready, execute it this way to actually delete the images:

But wait ….

It seems that when we actually want to prune the registry it cannot connect to it. But fortunately there is a solution! Two things need to be done, first export the registry SSL certificate for our connection. Second, expose the registry as a route so that we can access it.

Now you can run the prune images again. But this time add also two new flags: registry-url and certificate-authority.

And voila, if you connect to your system via ssh again, you can see that some space was recovered.


The steps above explain how to do some Housekeeping in CRC in order to claim back some disk space. There are some more complex technics to resize the disk, like the ones in this thread:

Also, CRC is constantly evolving and it may implement a way to define the disk size before installing it, like minishift did. But in the meantime, this commands may save you a headache.