Skip to main content
In this guide, we’ll walk through manually backing up your Jenkins home directory and validating the archive in an isolated environment. This process helps ensure you can fully restore Jenkins configuration, jobs, plugins, and credentials in the event of a failure.

1. Locate the Jenkins Home Directory

List the contents of /var/lib and filter for “jenkins” to identify the home directory and any existing backups:
You should see:
  • jenkins/ – the active Jenkins home directory.
  • Any previous archives like jenkins-EOF.tar.gz.
The default Jenkins home path is /var/lib/jenkins.

2. Create a Compressed Backup

Use tar to archive and compress the entire Jenkins home directory, saving it under /tmp with a timestamped filename:
This command will:
  • Recursively package jenkins/.
  • Compress the archive (.tar.gz).
  • Name it with the current date and time (e.g., 202502070714).
Using a timestamp in your backup filename (e.g., $(date +"%Y%m%d%H%M")) makes tracking and rotating archives much easier.
Depending on the data size, this may take a few minutes.

3. Verify the Backup Archive

After the tar command completes, confirm the archive exists and check its size:
A few gigabytes is common for Jenkins installations with extensive job history and plugins.

4. Prepare a Test Environment

To validate the integrity of your backup without impacting production, create a sandbox copy:
  1. Stop the Jenkins service to avoid data changes during copy.
  2. Copy the home directory to /tmp/jenkins-backup.
  3. Inspect the backup contents.

4.1 Stop Jenkins

Stopping the production Jenkins service may interrupt active builds. Perform this step during a maintenance window.

4.2 Extract or Copy

Common subdirectories in a Jenkins home backup:

5. Point a Jenkins Instance at the Backup

Launch a standalone Jenkins instance using your sandboxed backup directory as JENKINS_HOME:
  1. Export the environment variable:
  2. Run the Jenkins WAR on a non-standard port (e.g., 9999):
  3. Monitor startup output:

6. Validate in the Browser

Open your browser and navigate to:
You should see the Jenkins login screen. After authentication, verify that:
  • All your jobs are listed.
  • Plugin manager shows installed plugins.
  • Credentials, system configurations, and user accounts match production.
This successful validation confirms that your backup archive is complete and restorable.

Watch Video