Change the attachments directory location for Jira server
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Overview
As of JIRA 4.2, for security reasons, the ability to change the directory where attachments are stored has been removed. So, if you use any version between 4.2 and 5.1.x you'll have to manually change the attachments location property on JIRA's database. However, this won't work on any version of JIRA from 5.2 and beyond, in which this policy was enforced and JIRA will refuse saving attachments if a custom path is defined.
This document aims to provide some workarounds to be able to change the location of the attachments on any version of JIRA from 4.2 to the latest, in case you need to do so due to storage space constraints or any other reason.
Please note this may affect JIRA's performance if there's any considerable delay on reading files from another drive (if the attachments are moved to a network drive, for example).
Workaround
JIRA 5.2 and above
Create a symbolic link on your server from the default attachment path (<JIRA_HOME>/data/attachments
) to the path where you want your attachments to be stored.
Creating a symbolic link on Linux
Replace <Jira_home> on the samples below with the full path to your Jira home location;
Move the content of <Jira_home>/data/attachments to the new location, for instance, under /Users/imurakami/newloc/
1
2
cd <JIRA_HOME>/data/attachments
mv * /Users/imurakami/newloc/
Run the below command on the system's command line.
1
2
3
4
ln -s /path/to/file /path/to/symlink
On our sample:
sudo ln -s ~/newloc/ <Jira_home>/data/attachments
Now, inside <JIRA_HOME>/data folder, instead of seeing the folder attachments, you will only see the symbolic link to the new location. There should not have an attachments folder under <jira_home>/data otherwise system will find the existing attachments directory first and not the attachments symlink.

Adjust the owner, group, and required permissions to allow the user used to start Jira to access the location.
1
2
3
4
5
6
7
8
9
cd <Jira_home>/data
chmod -R 755 newloc
sudo chown -R jira *
sudo chgrp -R jira *
cd /Users/imurakami
chmod -R 755 newloc
sudo chown -R jira newloc
sudo chgrp -R jira newloc
Creating a symbolic link on Windows
Run the below command on the system's command line.
1
mklink /J C:\path\to\symlink E:\path\to\file
JIRA 4.2 to 5.1.x
All platforms
Always back up your data before performing any modification to the database. If possible, try your modifications on a test server.
Shutdown JIRA.
Run the following SQL queries to change the directory:
1 2 3 4 5
UPDATE propertystring SET propertyvalue='/path/to/attachments' WHERE id IN ( SELECT id FROM propertyentry WHERE property_key = 'jira.path.attachments' );
Replace
/path/to/attachments
with the actual path where you want to have attachments saved. Make sure the user that runs JIRA has read and write permissions on the chosen folder.1 2 3 4 5
UPDATE propertynumber SET propertyvalue = 0 WHERE id IN ( SELECT id FROM propertyentry WHERE property_key = 'jira.path.attachments.use.default.directory' );
1 2 3 4 5
UPDATE propertynumber SET propertyvalue = 1 WHERE id IN ( SELECT id FROM propertyentry WHERE property_key = 'jira.option.allowattachments' );
The above queries have been composed and validated on a PostgreSQL database and may need changes to its syntax for other DBMS.
Start JIRA;
Was this helpful?