Changing the default data directory in a TeamCity server, would require the following steps
1) First Stop the TeamCity server with the following command,
/opt/jetbrains/TeamCity/bin/runAll.sh stop
2) Copy all the files and directories with the same permissions, from the default data directory “/root/.BuildServer” to the directory which we want to be the new data directory “/opt/teamcity-data“.
3) Edit the file “teamcity-startup.properties” & set the “teamcity.data.path” to “/opt/teamcity-data“.
4) Now Start the TeamCity Server(/opt/jetbrains/TeamCity/bin/runAll.sh start)
5) Now, open the TeamCity GUI and verify that the data directory has been updated to “/opt/teamcity-data“. Consequently, all data related to “artifacts” will be stored within the “/opt/teamcity-data” directory going forward.