TeamCity 9.0 Help

Free disk space

By default, the required free space for a build is set to 3 GB. The "Free disk space" build feature allows customizing this value to ensure the build gets enough disk free space on the build agent.

Analyzing and freeing disk space

Before the build and before each build preparation stage, the agent will check the currently available free disk space. If the amount is less than required, it will try to clean data of other builds before proceeding.

The data cleaned includes:

  • the checkout directories that were marked for deletion;

  • the cache of previously downloaded artifacts (that were downloaded to the agent via TeamCity artifact dependencies)

  • contents of other build's checkout directories in the reversed most recently used order.

The disk space check is performed for two locations: the agent's temp directory and the build checkout directory.

You can use the Free disk space build feature to alter the default value of 3 GB.

If you need to make sure a checkout directory is never deleted while freeing disk space, set the system.teamcity.build.checkoutDir.expireHours property to "never" value. See more at Build Checkout Directory.

Other ways to set the free disk space value

Besides, for compatibility reasons the free disk space value can be specified via properties. However, it is advised to use the build feature as the properties can be removed in the future TeamCity versions. The properties can be defined:

  • globally for a build agent (in agent's buildAgent.properties file)

  • for a particular build configuration by specifying its system properties.

The required free space value is defined with the following properties: system.teamcity.agent.ensure.free.space for the build checkout directory. system.teamcity.agent.ensure.free.temp.space for the agent's 'temp' directory. If teamcity.agent.ensure.free.temp.space is not defined, the value of the teamcity.agent.ensure.free.space property is used.

The values of these properties specify the amount of the available free disk space to be ensured before the build starts. The value should be a number followed by kb, mb, gb, kib, mib, or gib suffix. Use no suffix for bytes. e.g. system.teamcity.agent.ensure.free.space = 5gb

Configuring artifacts cache

TeamCity build agent maintains a cache of the published and downloaded build artifacts for the purpose of reducing network transfers to the same agent. The cache is stored in <Build Agent home> \system\.artifacts_cache directory and should be cleaned automatically once Free disk space build feature is configured correctly.

If caching the artifacts is undesirable (for example when the artifacts are large and not used within TeamCity, or if the artifacts cache directory is located not on the same disk as the build checkout directory, or if the builds do not define the Free disk space build feature and the default 3Gb is not sufficient for a build), caching artifacts on the agent can be turned off by adding the teamcity.agent.filecache.publishing.disabled=true configuration parameter to a project or one of the build configurations of a project. However, the agent will still cache artifacts downloaded as artifact dependencies.

Last modified: 20 April 2023