To free up space on C:
, I would like to move my Jenkins data files (specifically the \\jobs
directory) from the default installation directory
For WINDOWS:
Copy all data from
C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins.jenkins
to D:\Jenkins\home
Go to Jenkins installed folder C:\Program Files\Jenkins
Stop the running Jenkins service from the command line - jenkins.exe stop
Uninstall the Jenkins service from the command line - jenkins.exe uninstall
Update jenkins.xml
as <env name="JENKINS_HOME" value="D:\JenkinsHome"/>
Install the Jenkins service from the command line- jenkins.exe install
Start the Jenkins service from the command line- jenkins.exe start
Login to Jenkins http://localhost:8080
Navigate to Manage Jenkins > Configure System
Verify Home directory must point to D:\JenkinsHome
Having the same problem and not wanting to change the whole %JENKINS_HOME%
location, I came across the answer by adil ameen
Modify the config.xml
file in %JENKINS_HOME%
(typical under C:\Program Files (x86)\Jenkins).
Change <workspaceDir>
and <buildsDir>
to your desired folder.
You can use the following placeholders: ${JENKINS_HOME}
, ${ITEM_ROOTDIR}
, ${ITEM_FULL_NAME}
. As specified at Features controlled by system properties under jenkins.model.Jenkins.buildsDir
Mine looks like this:
<workspaceDir>D:/jenkins/jobs/${ITEM_FULL_NAME}/workspace</workspaceDir>
<buildsDir>D:/jenkins/jobs/${ITEM_FULL_NAME}/builds</buildsDir>
Reload the configuration through the Jenkins UI via Jenkins
-> Manage Jenkins
-> Reload configuration from disk
You can even keep your build history if you copy the old jobs to the new location.
first set the jenkins home path and then run /install jenkins.war
example :
set JENKINS_HOME=D:\
java -jar jenkins.war --httpPort=8091 -path=D:\<some-folder-name>\
For Jenkins 2.0, it was only necessary to add a system environment variable called "JENKINS_HOME" that points to the new location. The steps I used:
Stumbled upon this question because I was short on HDD on C:/ but had plenty on D:/.
The answer of Jeanne Boyarsky had exactly zero effect on my Jenkins. Although I changed the two variables, Jenkins still used the original workspace
and jobs
directories which consumed 1/3 of my C:/ drive.
A colleague pointed me to the dead easy solution of simply using Symbolic Links for the directories.
After shutting down Jenkins, open your CMD
on the %JENKINS_HOME%
directory and simply create two links for the big directories:
pushd %JENKINS_HOME%
:: save the old directories
ren workspace workspace.old
ren jobs jobs.old
:: now create the links
mklink /D /J workspace D:\jenkins\workspace
mklink /D /J jobs D:\jenkins\jobs
:: copy the original jobs to the new location
xcopy jobs.old\* jobs\ /sy
After this, restart your Jenkins. If everything works fine, you can safely delete the .old
directories.
If you are using jenkins version older than 2.0 than you should do following:
1) open jenkins -> manage Jenkins -> Configure System. Check the path of your Home Directory.
2) Stop the jenkins service.
3) copy the jenkins home directory to other drive or location you want to move.
4) open jenkins.xml from program files and modify the value <env name="JENKINS_HOME" value="d:\Jenkins"/>
Change the d:\Jenkins to your new path.
5) restart the Jenkins service.
6) test your job :)