To free up space on C:
, I would like to move my Jenkins data files (specifically the \jobs
directory) from the default installation directory C:\Program Files (x86)\Jenkins
to F:\Jenkins\home
. I think what I need to do is set the JENKINS_HOME
environment variable to F:\Jenkins\home
. But no matter what I try, the JENKINS_HOME
environment variable is always set to the location of jenkins.exe
.
Related:
Here is what I've tried so far:
jenkins.exe uninstall
%HOMEPATH%\.jenkins
directoryv1.597
C:\Program Files (x86)\Jenkins2
(renamed to ensure there are no stale values in the registry or config files)JENKINS_HOME
to F:\Jenkins\home
JENKINS_HOME
to F:\Jenkins\home
jenkins.xml
to use <env name="JENKINS_HOME" value="F:\Jenkins\home"/>
At this point, when I look at the system configuration, JENKINS_HOME
is set to C:\Program Files (x86)\Jenkins2
. So it seems it must always be set to the location of jenkins.exe
.
Maybe I've answered my own question. I'd like to have the program and data separate, if possible. Do I have to install jenkins to my F:\
drive? Or, is there a way to simply split off the jobs
directory and leave everything else on C:
?
Thanks!
EDIT : I did not have to move JENKINS_HOME
, but instead was able to configure the workspace and builds directories, which moved all the heavy disk usage over to F:
. The settings I chose were:
Workspace Root Directory = F:/Jenkins/workspace/${ITEM_FULLNAME}
Build Record Root Directory = F:/Jenkins/jobs/${ITEM_FULL_NAME}/builds
I manually migrated these directories so they would not have to be recreated. During this process I did lose my build history, but I'm okay with that for now.
To change the location of Jenkins Home on Windows, simply add or update the JENKINS_HOME system variable and restart the CI/CD tool. When it restarts, the new Jenkins Home location will be used.
So if you wish to change the Jenkins workspace, all you've do is change the path of your JENKINS_HOME. For slave nodes, specify the default workspace on the slave machine in the slave configuration under Manage Jenkins > Manage Nodes > > Configure > Remote FS root.
Pre Jenkins 2.121
JENKINS_HOME is where Jenkins is installed which is not what you want to change. After you start up Jenkins, go to:
This gives you text fields where you can change the directory for the workspace and builds directories. Those are the two directories that use a good bit of disk space. Note that it will not move history. If you want to move the existing workspaces/etc, you'll need to manually copy them over.
Post 2.121 You have to set properties (not through the UI). The system property to use is jenkins.model.Jenkins.buildsDir.
https://jenkins.io/doc/upgrade-guide/2.121/#ui-option-for-custom-builds-and-workspace-directories-on-the-master-has-been-removed https://wiki.jenkins.io/display/JENKINS/Features+controlled+by+system+properties
Another possibility is to move the entire contents of $JENKINS_HOME.
It does not require editing configuration files, and it preserves the build history.
Stop the running service: jenkins.exe stop
Uninstall the service: jenkins.exe uninstall
Copy C:\Jenkins\home to F:\Jenkins\home
Rename C:\Jenkins to something else, keep it as backup.
Go to F:\Jenkins\home
Reinstall the service: jenkins.exe install
Start Jenkins: jenkins.exe start
Enjoy the new disk space!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With