Partilhar via


Azure App Service - What is taking my disk space for my Azure Web App ?

While working on Azure App service, you may notice disk full errors. These may surface in different ways for e.g.

  1. The application may get the error "System.IO.IOException: There is not enough space on the disk".
  2. You may see disk errors while browsing to the KUDU Console.
  3. You try to publish using VSTS or Visual Studio and you get an error like "ERROR_NOT_ENOUGH_DISK_SPACE: Web deployment task failed. (Web Deploy detected insufficient space on disk)".

In this post, I will cover how you can identify why you are getting these errors, and identify what inside your Web App might be consuming disk space.

First and foremost, it is important to understand that each App Service Plan gets an allocation of disk space corresponding to the pricing tier.

At the time of writing of this blog, this is the amount of disk space that is available per pricing tier ( This might change in future so you should check out https://azure.microsoft.com/en-in/pricing/details/app-service/plans/ which should have the updated information.)

 

FREE SHARED BASIC STANDARD PREMIUM
Disk space 1 GB 1 GB 10 GB 50 GB 250 GB

 

All of your Web Apps in the same App Service Plan will share the disk space. If your files on the disk exceed this limit, you will start getting disk full kind of errors.

Your files will include one or more of the items in the following list.

  • The Web Site Content
  • The App_Data for an Asp.Net Application
  • The Logfiles folder.

The reason why it becomes a little tricky to figure out this issue is because you have may have multiple Web Apps in an App Service Plan. If one of the Web Apps is taking more disk space than the others, you may not be able to easily identify which Web App to investigate.

However, to help you, the Quotas blade at the Web App level in Azure portal (https://portal.azure.com/) allows you identify this issue easily. Here is a screenshot of what I see when search for Quotas in the settings for my Web App.

 

 

In the above screenshot, you can see two quotas.

  1. The File System Usage (App)  which is the disk space consumed by my Web App.
  2.  The File System Usage (App Service Plan)  which is the disk space consumed by the App Service plan.  

 The above image illustrates that the App Service plan is consuming 6.13GB of disk space (out of 50 GB total as my Web App is on a Standard Plan which gives me 50 GB) and my Web App is consuming 4.68 GB out of this 6.13 GB.

The remaining disk space is consumed by the other Web Apps in the App Service Plan.

So from here, I can quickly identify whether my current Web App (i.e. the Web App currently selected in the portal) ,is consuming high disk space or if the disk space is consumed by another Web App in the same App Service Plan. If the current Web App is consuming the disk space then I have already identified the culprit, otherwise I will look at the other Web Apps in my App Service Plan and check the Quotas blade for those Web Apps individually.

To list all of  the Web Apps in the App Service plan , I can click on App Service Plan for my Web App and click on the  Apps setting.  This will show me all the sites under my App Service Plan and from there on , I can click on each Web App and look at the Quotas blade for that Web App to see how much disk space that Web App is consuming.

This maybe complex if there are many Web Apps under the same App Service Plan. Please note that this part of the portal is subject to change and please feedback on https://feedback.azure.com if you have any input.

In the meantime, I wrote a small PowerShell script that can help you find this information . Just pass the Web App name and the subscription ID and the script will identify the App Service Plan for the Web App and show App Service Plan disk usage and a breakup of disk space consumed by all Web App and slots in your App Service Plan.

Once you identify the right Web App,  you may want to understand what content inside that Web App is consuming high disk space. For that, you can install the Disk Usage Site extension on that Web App to identify what exactly within that Web App is consuming the maximum space. There is a good external blog that talks about how to use this extension https://fenglu.me/2017/02/18/Review-and-manage-your-web-site-space-in-Azure/ so I am not going to repeat the steps but using this extension you can exactly identify which sites or folders within your WebApp content are consuming high disk space.

Hope this information helps !!!