Housekeeping - what's safe to delete?

I am looking at clearing down our instance.
From what I can see from digging around JENKINS_HOME we have one key directory that consumes the majority of space.

This consumes approx 50% of a 60gb file system in our setup.

Are there any other directories that I should be aware of that have potential to grow exponentially?

I would run a ‘du -m’ on $JENKINS_HOME but it takes an aaaaaaaaaaaage to run by which time my session times out.

Also, what is the best way to clear down the any ‘big hitter’ directories?


The jobs directory has all the config for your jobs, so don’t go deleting that willy nilly. The workspaces within those job directories could probably be cleaned up. If you don’t want to worry about it as much in the future, you can setup a log rotator policy in the job settings that will only keep a certain number of jobs, or only keep them for a specific number of days.

Thanks for the reply.
Workspaces caters for roughly 12% of the 60gb.

In terms of both jobs, and workspaces directories - what is the best way of deleting stuff here?

I can run a find command looking for directories that haven’t been touched in x amount of days before deleting them, but as you say configuration exists in the jobs directory so more care is required.
I’m fairly new to Jenkins management/sys admin/housekeeping so any guidance would be much appreciated.

I should also say a log rotator policy is already set up on most pipelines with the following code block in the job configuration:

    logRotator {

Though I’m not 100% sure what underlying files/configuration/logs get kept as a result.
Again, any guidance would be appreciated.

It seems weird that only 12% is used by workspaces, I would expect that to be a much higher percentage of the 60GB. The numToKeep will keep up to 30 workspaces/builds and start deleting things after 30 builds (oldest deleted first). Are there any builds that are marked to be kept? Each job will have a directory and inside that directory will be a config.xml which is the job configuration and then directories for the builds (I don’t remember if there is a “builds” subdirectory of the job or if the builds are just right there and I don’t have access to my Jenkins instance at the moment).

There appears to be a raft of pipelines listed in the jobs directory that we can’t even see in Jenkins GUI itself. Suggests they were removed from Jenkins but the history of the job and their config etc were removed without actually cleaning them off disk.

Is there a better way to determine what these are without having to manually search and cross reference what is on disk with what is in the GUI?

Not that I can think of, there might be something you can do with the script console, but I am not sure.