CoderSathi
  • Tutorial
    • Java Tutorial
    • Swing Tutorial
    • JDBC Tutorial
    • Java String Tutorial
    • Servlet and JSP Tutorial
  • Mongo DB
  • AWS
  • DevOps
  • Linux
  • Git
Home > How to > Clean Up Jenkins Home Directory

Clean Up Jenkins Home Directory

Learn the concepts, implementation details, and practical steps with a clean developer-focused walkthrough.

Yuba Raj Kalathoki
By Yuba Raj Kalathoki
Published: August 31, 2020 ยท 3 min read ยท 0 Comments
Share: X in ๐Ÿ”—
logo jenkins

Developers and DevOps professionals frequently use Jenkins as a tool for automating tasks. However, like any software, it is essential to maintain it well for smooth operation. Unfortunately, people often overlook the maintenance of the Jenkins home directory, which can become cluttered and full over time. Therefore, in this post, we will examine how to clean up Jenkins home directory when it becomes full.

Symptoms of a Full Jenkins Home Directory

If the Jenkins home directory is full, you may notice some performance issues or error messages. For example, builds may take longer to complete, or you may see error messages related to insufficient disk space. It’s important to address these issues as soon as possible, as a full Jenkins home directory can lead to more serious problems down the line.

Causes of a Full Jenkins Home Directory

There are a few common causes of a full Jenkins home directory. One is old builds and logs taking up space. As you run builds, Jenkins stores the build artifacts and logs in the home directory. If you don’t regularly delete old builds and logs, they can add up and take up a lot of space.

Storing large artifacts in the wrong location is another cause of a full Jenkins home directory. By default, Jenkins stores all artifacts in the jobs/<job_name>/builds directory within the home directory. If you have large artifacts or build outputs that don’t belong in this location, moving them to a different location can free up space in the home directory.

Cleaning Up the Jenkins Home Directory

If you’ve determined that your Jenkins home directory is full, there are a few steps you can take to clean it up:

  1. Remove old builds and logs: You can use Jenkins’ built-in “Discard Old Builds” feature to delete old builds and logs. To access this feature, go to the “Configure” page for a job and scroll down to the “Build Triggers” section.
  2. Move large artifacts/ to a different location: If you have large artifacts that don’t need to be stored in the jobs/<job_name>/builds directory, you can move them to a different location. To move large artifacts to a different location, specify a different path in the “Archiving Artifacts” section of the “Post-build Actions” for a job..

If the above steps didn’t work then remove all the contents inside workspace directory.

Go to the Jenkins home directory. The default directory for Jenkins is /var/lib/jenkins.

cd /var/lib/jenkins

And remove all the folders and files available inside the workspace directory. Use the command below:


sudo rm -rf workspace/*

Don’t worry about your all the jobs to be deleted. All the jobs are inside jobs directory not inside this workspace directory. ๐Ÿ™‚

Disclaimer!

If your setup is default then all the jobs are stored inside the jobs directory. So, you don’t need to worry of being deleted all your jobs. If you have changed and stored inside workspace directory then this may delete all your jobs.

With the help of the above steps, we can easily free up the space used in Jenkins.

Conclusion

In this blog post, we learned to clean up the Jenkins home directory by using the remove command mentioned above.

Related Posts:

  • How To Print Git Commit Message In Jenkins Pipeline
  • Thread Deadlock in Java
  • Software Engineering Introduction
  • Spring Boot Async Tasks: A Complete Guide to…
  • Spring Boot Thread Pool Configuration: Optimizing…
  • Comparator in Java
Tags:devopsjenkins
Was this article helpful?
โ† Previous ArticleEasily Delete Last N Commits In Git
Next Article โ†’Print Git Branch Name in Jenkins Pipeline

Leave a Comment Cancel reply

You must be logged in to post a comment.

Recent Posts

  • How to Use AWS CloudFront Signed URLs in Spring Boot?
  • How to Fix SSH Agent Forwarding on macOS: The Ultimate Guide for Developers
  • How to Read AWS Secrets Manager in Spring Boot (Step-by-Step)
  • How to Fix “Public Key Retrieval is not allowed” MySQL JDBC Error
  • Complete Guide to JaCoCo: How to Measure Java Code Coverage Accurately
CoderSathi

Your go-to resource for Java, Spring Boot, Microservices, AWS, and modern development tutorials.

Quick Links

  • About
  • Contact

Popular Topics

  • Java
  • Spring Boot
  • AWS
  • DevOps
  • MongoDB
  • Linux
  • Git
  • How to
ยฉ 2026 CoderSathi. All rights reserved. Privacy Policy ยท Sitemap