Fix low space issue in Sitecore

Fix low space issue in Sitecore

We had run into an issue where disk space went very low. Therefore I have performed few steps that cleared 90% of the disk space without compromising with anything. Below are the steps to fix low space issue.

  1. Delete Sitecore packages from CM servers.
  2. Delete log files older than 30 days.
  3. Remove files from mediaIndexing folder older than an hour.
  4. Remove database files from App_Data/DeviceDetection folder older than 7 days.

1. Delete packages from CM severs

It is very common to forget to delete Sitecore packages when we are done installing/downloading them. Most of the times they are of no use. So, you can go ahead and remove them safely and Fix low space issue to some extent. If you are using SXA then consider removing packages under CreativeExchange folder too. These are the packages uploaded when you import the theme file.

2. Delete logs folder

Logs are stored in your data folder. By default, the location is App_Data/logs. Sometimes Sitecore does not delete log files. In order to delete them, put below line in patch config file to mark log files for deletion.

<remove folder="$(dataFolder)/logs" pattern="*log.*.txt*" maxAge="30.00:00:00" recursive="true" />

3. Delete files from mediaIndexing folder

Like log files, mediaIndexing files are also stored in data folder. mediaIndexing files are temporary files that has no use once media content in indexed. It is a good and safe strategy to clean them up if they are older than an hour. To do that, just add below line in patch config. You can refer Sitecore KB article for more info.

<remove folder="$(dataFolder)/mediaIndexing" pattern="*.*" maxAge="00.01:00:00"/>

4. Delete files from DeviceDetection folder

DeviceDetection folder stores database files inside data folder. Ideally we should have only latest database file in that folder. Sitecore doesn’t delete older databases but suggest to delete a week older database. So, you can delete all of them if you are not using Device Detection service. Refer Sitecore KB article for more info. So, you can delete these database files by adding below line in patch config file.

<remove folder="$(dataFolder)/DeviceDetection" pattern="*.*" maxAge="07.00:00:00" recursive="false" />

Final patch config:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <scheduling>
      <agent type="Sitecore.Tasks.CleanupAgent" method="Run" interval="06:00:00">
        <files hint="raw:AddCommand">
          <remove folder="$(dataFolder)/logs" pattern="*log.*.txt*" maxAge="30.00:00:00" recursive="true" />
          <remove folder="$(dataFolder)/mediaIndexing" pattern="*.*" maxAge="00.02:00:00"/>
          <remove folder="$(dataFolder)/DeviceDetection" pattern="*.*" maxAge="07.00:00:00" recursive="false" />
        </files>
      </agent>
    </scheduling>
  </sitecore>
</configuration>

Tips for Azure hosting to fix disk space issue

If your Sitecore instance in hosted in Azure then I have got below tips for you.

1. Limit of 500 GBs for app services in same resource group, region.

If you have Sitecore instance hosted in Azure, you need to pay attention to the disk space limit. As per Microsoft

The total content size of all apps across all App service plans in a single resource group and region cannot exceed 500 GB.

Microsoft

2. Install Disk Usage Extension

You can install Azure Web Apps Disk Usage Site Extension to your web app to know exact size of each folder within the app service.

Coding Crest Back To The Top