Schedule your backups according to your change management policy—daily incremental snapshots plus weekly full backups often strike a good balance between data safety and storage cost.
Backup Approaches
Choose one or combine multiple methods to build a resilient backup strategy:| Method | Description | Pros | Cons |
|---|---|---|---|
| Filesystem Snapshots | Use Linux LVM snapshots or cloud provider block snapshots for point-in-time consistency. | Fast, consistent | Requires compatible storage subsystem |
| Jenkins Backup Plugins | ThinBackup is the only actively maintained plugin for automated backup of Jenkins home. | Easy setup, schedules automated jobs | Plugin limitations; may not catch all data |
| Custom Shell Scripts | Scripts to rsync or tar the essential Jenkins directories to remote storage. | Fully customizable | Requires maintenance and testing |
| Hybrid Strategy | Perform local backups first, then transfer archives to offsite or object storage (S3, GCS). | Maximizes redundancy | Involves additional network/config steps |
Essential Files and Directories
Jenkins stores all configuration, job definitions, plugins, and credentials in the JENKINS_HOME directory (default:/var/lib/jenkins). Backing up the entire directory is feasible but may be overkill. Focus on the components below:
| Component | Purpose |
|---|---|
| config.xml | Main Jenkins system settings (global configuration). |
| *.xml | Other site-wide configs (e.g., credentials.xml, nodes.xml). |
| jobs/ | Job definitions and build histories. Exclude large artifacts if storage is limited. |
| plugins/ | Installed plugins (.jpi, .hpi). You can reinstall plugins from the update center if needed. |
| secrets/ | Encryption keys and credentials. |
| userContent/ | Static files served via https://<jenkins>/userContent/. |
| workspace/ | Working directories for SCM checkouts (typically safe to skip; recreated on build). |
Never store unencrypted secret keys or credentials in public or shared backup locations. Always encrypt backups that include the
secrets/ directory.Restoring Jenkins
- Stop the Jenkins service:
- Restore your backup archive or snapshot to
JENKINS_HOME. - Ensure correct ownership and permissions:
- Start Jenkins and verify logs for any errors: