# Jenkins Backup & Restore

Jenkins is a powerful tool for Continuous Integration and Continuous Deployment (CI/CD). As with any critical system, ensuring that your Jenkins setup is backed up and can be restored is essential.

**<mark>Why Backup Jenkins?</mark>**

Backing up Jenkins is crucial for several reasons:

* **System Failures:** Hardware or software failures can occur, and a backup ensures you can quickly recover.
    
* **Human Error:** Mistakes can happen, such as accidental deletion of jobs or configuration changes.
    
* **Upgrades and Migration:** When upgrading Jenkins or migrating to a new server, having a backup helps prevent data loss.
    

**<mark>Agenda :</mark>**

1 : Install ThinBackup plugin  
2 : Configure ThinBackup Plugin  
3 : Backup and Restore

**<mark>Step 1 : Install ThinBackup plugin</mark>**

Click on `Manage Jenkins`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723538028294/7e2c5e01-2410-488c-93ef-75ed575f024d.png align="center")

Navigate to `Plugins`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723538118664/53d53a05-30f8-4b8f-ac90-49ad05cc0eab.png align="center")

Click on `Available plugin` , search for `ThinBackup` and install it

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723538280441/c1224ef7-8702-4922-88a4-7caee9aae32f.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723538445225/bbab80cf-fd38-40ae-96b8-f3e58b4d3fca.png align="center")

**<mark>Step 2 : Configure ThinBackup Plugin</mark>**

Now check in the Manage Jenkins page; the `ThinBackup` feature is newly added.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723538596886/6d425bd2-7c46-44a5-a2df-bca47edc4025.png align="center")

Create a folder `jenkins_backup` inside `/var/lib/jenkins` on your Jenkins machine.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723539452374/cdce612e-9266-4851-99be-22034c67c18c.png align="center")

Give permission to that directory

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723539695696/9c194c22-13db-4f0f-ae3c-8e450f4e4414.png align="center")

Go to `Manage Jenkins` &gt; Click on `System` &gt; Enter backup dir path

Add backup path `/var/lib/jenkins/jenkins_backup`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723539823154/dd973a32-aab8-484d-905c-06979ed3d2b8.png align="center")

Select needed options &gt; Click `Save`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723548301480/a3681c7a-a394-490f-aa3b-baf74827443f.png align="center")

**<mark>Step 3 : Backup and Restore</mark>**

Click `Backup now` option, this will take few seconds

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723539958307/b90fd7b2-ea07-4f91-856c-fbb7e01fc24e.png align="center")

Go to the backup directory you specified earlier. Ensure that backup files have been created

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723549064767/27754b0d-6d7f-4d8c-acd0-8341559c8f95.png align="center")

To ensure your backups are working correctly, delete any job

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723549382844/4a618144-6d6a-40c0-98be-16dd98676cb8.png align="center")

Click Yes

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723549411977/ca490a99-482d-4407-85d2-3f9a94b2b112.png align="center")

Now, Click Restore option

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723549501625/ab1ba20d-844a-4ffe-8ce8-75ae7c064d69.png align="center")

Choose your backup date & time &gt; Click Restore

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723549559343/4a31c46e-1efc-4083-8976-481f87ecb474.png align="center")

Now, you can see deleted jobs.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1723549751607/14cea397-0729-4391-bffe-9cab35463cca.png align="center")

### **Conclusion**

Backing up and restoring Jenkins is a crucial part of maintaining a reliable CI/CD pipeline.
