Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the Jenkins Home Directory from /var/lib to app and create a symlink for orginal location as job wont get affected

I need to change my Jenkins 2.89.3 version Home Directory from /Var/lib/jenkins to /app due to space constraints. I need to make sure , all jobs which are using the /var/lib/jenkins directory wont get affected by this migration. how to perform this operation and ran my jenkins job as expected

Current size of /var/lib/jenkins 5.1G
Move all contents to /app/
run jenkins jobs without any issues 

Please help in this migration

like image 799
Manigandan Thanigai Arasu Avatar asked Oct 19 '25 10:10

Manigandan Thanigai Arasu


1 Answers

You can use a symbolic link to do that:

  1. Shutdown you Jenkins.
  2. Move all files from /var/lib/jenkins to /app/jenkins

    mv /var/lib/jenkins /app/
    
  3. Replace /var/lib/jenkins with a symbolic link to /app/jenkins

    ln -s /app/jenkins /var/lib/jenkins
    
  4. Start Jenkins again.

That way all the files are actually stored under /app but all paths to /var/lib/jenkins stay valid due to the symbolic link.

like image 55
Michael Avatar answered Oct 21 '25 22:10

Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!