7
votes

I cannot build in VSTS with hosted agent (VS 2017) with error:

System.IO.IOException: There is not enough space on the disk

I have tried setting "Clean" option to true on Build , Repository definition without solving the issue. I didn't have this option set to true which I imagine led to the current situation.

Also installed VSTS extension "Clean Agent Directories" and added as last step of the build process without solving the issue either.

Is there an option that would allow me to solve this issue and continue using the hosted build agent ?

2
How big is your repository?Daniel Mann
Local copy of whole solution is 2.6GBdonquijote
But how big is the entire repository? And are you using Git, or TFVC?Daniel Mann
Is Git repository. The .git folder inside the solution's local folder is 692MB, if I download the whole repo from VSTS as zip is 19MB and unzipped is 46MB. Sorry if i'm not precise, I'm relatively new to git and VSTSdonquijote
Also in case that helps to understand how the build might multiply the size, the solution is a ASP.NET MVC with multiple webjobs.donquijote

2 Answers

7
votes

Hosted agents offer 10 GB of space. You stated that your entire solution folder is 2.6 GB. Your build outputs will typically be somewhere in the range of 2x that size, if not larger, depending on various factors.

If you're a Git user, this the entire repo that's being cloned may be significantly larger than 2.6 GB, as well -- cloning the repo brings down not only the current working copy of the code, but also all of the history.

You can control the clone depth (e.g. how much history is pulled down) by enabling Shallow fetch under the Advanced options of your repo settings.

If you're a TFVC user, you can check your workspace mappings to ensure only relevant source code is being pulled down.

You may be in a situation where the 10 GB simply isn't sufficient for your purposes. If the 2.6 GB is purely code and contains no binary assets (images, PDFs, video files, etc), you may want to start modularizing your application so smaller subsections can be built and independently deployed. If the 2.6 GB contains a lot of binary assets, you'll likely want to separate static content (images, et al) from source code and devise a separate static content deployment process.

2
votes

According to Microsoft's documentation,

(Microsoft-hosted agents) Provide at least 10 GB of storage for your source and build outputs.

So, if you are getting "not enough space in disk error" it might mean that the amount of disk space used by your source code (files, repos, branches, etc), together with the amount of disk space taken by your build output (files generated as a result of the build process) is crossing the 10 GB of storaged provided by your DevOps plan.

When getting this error I had to delete an old git repo and an old git branch, getting 17 MB of free space, which was enough for my build to process. Thus, in my case the space was being used up by source code. It could well be too many or too big files being generated by the build. That is, you just need to find out which one of these two is the cause of your lack of disk space, and work on freeing it.