Delete old self-hosted VSTS build agent _work folders

7.6k views Asked by At

We have a self-hosted TFS build agent which has run out of space so I would like to delete as many of the folders under the agent\_work and agent_dply\_work folders as possible, where they are > 1 month old.

Is this safe to do?

I have found this post on setting up cleaning, which I will certainly do.

Also found this post on cleaning the _work folder which recommends renaming, then deleting the whole folder, but not parts of it.

What I can't find is the maintenance settings for the agent pool, as described in this post. I'm wondering if this is in some control panel on the actual agent, because it does not appear to be in our settings. I looks for it under Project > Project Settings > Agent pools, for example:

https://COMPANY.visualstudio.com/PROJECT/_settings/agentqueues

1

There are 1 answers

4
PatrickLu-MSFT On BEST ANSWER

It's safe to do this. Besides I would recommend you follow suggestion mentioned by TingluoHuang in second link.

Just need pay attention to follow:

Make sure there is no running job on the agent and stop the agent process/service first before delete/rename any folder

Actually, there is a setting related to configuring reoccurring maintenance (Organization Settings -> Agent Pools -> <Pool Name>-> Settings [tab]).

enter image description here

And then you could find related sett

You need first turn off Maintenance job. And then you will find related setting there.

enter image description here