How change the mount point of the Jenkins home directory in Ubuntu

If you need to change the mount point of the Jenkins home directory follow the instruction below:

  1. Stop Jenkins /etc/init.d/jenkins stop
  2. Create folder for new Jenkins home directorymkdir home
  3. Change access rights for this folder and all folders and files insidesudo chown -R jenkins:jenkins home
  4. Find current Jenkins folder and copy all directories and files into new one. If you don't know current Jenkins directory you can find it in /etc/default/jenkins file. More details here.sudo -u jenkins cp -r /var/lib/jenkins/* home/
  5. Change JENNIKS_HOME inside /etc/default/jenkinssudo nano /etc/default/jenkins find JENKINS_HOME and change path to new Jenkins home folder
  6. Start Jenkins /etc/init.d/jenkins start 
  7. In case if you have the error message Unable to create the home directory ‘/path/to/jenkins/home’. This is most likely a permission problem. run the command sudo chown -R jenkins:jenkins root_folder/To get the root_folder you need go to Jenkins home folder and run pwd. This will work in case if you want use other one hdd (not system) for Jenkins home .$pwd
    /media/path/to/jenkins/home
    In my case the root_folder is media

That's all. Enjoy!