Configuring Cell Disk Cleanup Scheduling

Page last updated:

Warning: Pivotal Cloud Foundry (PCF) v2.3 is no longer supported because it has reached the End of General Support (EOGS) phase as defined by the Support Lifecycle Policy. To stay up to date with the latest software and security updates, upgrade to a supported version.

This topic describes how to configure disk cleanup scheduling on Diego cells in Pivotal Cloud Foundry (PCF).

What is Disk Cleanup

PCF isolates application instances (AIs) from each other using containers that run inside Diego cells. Containers enforce a set of isolation layers including file system isolation. A PCF container file system can either be a PCF stack or the result of pulling a Docker image.

For performance reasons, the cells cache the Docker image layers and the PCF stacks used by running AIs. When PCF destroys an AI or reschedules an AI to a different cell, a chance exist that certain Docker image layers or an old PCF stack becomes unused. If PCF does not clean these unused layers, the cell ephemeral disk will slowly fill.

Disk cleanup is the process of removing unused layers from the cell disk. The disk cleanup process removes all unused Docker image layers and old PCF Stacks, regardless of their size or age.

To perform a detailed analysis of disk usage in your PAS deployment, see Examining GrootFS Disk Usage.

Options for Disk Cleanup

PCF provides the following options for scheduling the disk cleanup process on Diego cells:

  • Never clean up the Cell Disk: Pivotal does not recommend using this option for production environments.
  • Routinely clean up the Cell Disk: This option makes the cell schedule a disk cleanup whenever a container is created. Running the disk cleanup process this frequently can result in a negative impact on the cell performance.
  • Clean up Disk space once a threshold is reached: This option makes the cell schedule the disk cleanup process only when a configurable disk space threshold is reached or exceeded.

See the Configure Disk Cleanup Scheduling section of this topic to select one of these options.


Selecting the best option for disk cleanup depends on the workload that the Diego cells run.

For PCF installations that primarily run buildpack-based apps, Pivotal recommends selecting the Routinely clean up Cell Disk space option. The Routinely clean up Cell Disk space option ensures that when a new stack becomes available on a cell, the old stack is dropped immediately from the cache.

For PCF installations that primarily run Docker images, or both Docker images and buildpack-based apps, Pivotal recommends selecting the Clean up Disk space once a threshold is reached option with a reasonable threshold.

Calculating a Threshold

To calculate a realistic value when configuring the disk cleanup threshold, you must identify some of the most frequently used Docker images in your PCF installation. Docker images tend to be constructed by creating layers over existing base images. In some cases, you may find it easier to identify which base Docker images are most frequently used.

To calculate the disk cleanup threshold, do the following:

  1. Identify the most frequently used Docker images or base Docker images.

  2. Using the Docker CLI, measure the size of those images.

    For example, you may determine the most frequently used images in a test deployment are openjdk:7, nginx:1.13, and php:7-apache. In this case, you can run the following commands to pull the identified images locally, then measure their sizes:

    $> docker pull openjdk:7
    $> docker pull nginx:1.13
    $> docker pull php:7-apache

    $> docker images REPOSITORY TAG IMAGE ID CREATED SIZE php 7-apache 2720c02fc079 2 days ago 391 MB openjdk 7 f45207c01009 5 days ago 586 MB nginx 1.13 3448f27c273f 5 days ago 109 MB ...

  3. Calculate the threshold as the sum of the frequently used image sizes plus a 15-20% buffer.

    For example, using the output above, the sample threshold calculation is: ( 391 MB + 586 MB + 109 MB ) * 1.2 = 1303.2 MB

Configure Disk Cleanup Scheduling

  1. Navigate to the PCF Operations Manager Installation Dashboard.

  2. Click the Pivotal Application Service (PAS) tile, and navigate to the Application Containers tab. Docker registry ert

  3. Under Docker Images Disk-Cleanup Scheduling on Cell VMs, select an option.

  4. If you select Clean up Disk space once threshold is reached, you must complete the Threshold of Disk Used (MB) field. Enter the disk space threshold amount in MB that you calculated for your deployment, as described in Calculating a Threshold.

  5. Click Save.

Next Steps

If you are configuring PAS for the first time, return to your specific IaaS configuration to continue the installation process.

If you are modifying an existing PAS installation, return to the PCF Ops Manager Installation Dashboard, click Review Pending Changes, and click Apply Changes.