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.
$JENKINS_HOME/jobs/
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.
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?
I think it is generally safe to delete the contents of the jarCache directory on Jenkins agents.
The jarCache directory is used to store cached JAR files that Jenkins downloads for various tasks. Deleting these cached files can help free up disk space and resolve issues related to corrupted or outdated JAR files.
However, keep in mind the following:
Deleting the cache may temporarily impact performance as Jenkins will need to re-download the necessary JAR files the next time they are required.
Ensure that no jobs are currently running on the agent when you delete the cache to avoid any potential disruptions.
If you are concerned about potential issues, you can back up the jarCache directory before deleting its contents.