Issue
Incorrectly copying Jenkins instances can break job symlinks.
This can cause DirectoryNotEmptyException
and permalink
errors in the logs and prevent job history from loading correctly,
even causing job builds to fail.
Resolution
Copying Jenkins directories to new location on same instance
cp -Rp SOURCE TARGET
The -R
switch is for recursive and the -p
switch ensures that links are preserved.
Copying Jenkins directories to new location on different instance
rsync -avz -e ssh /src/dir user@remote.host:dst/dir
NOTE Do not use scp
to copy Jenkins to another instance as scp does not preserve symlinks.