Manage disk space

You can find the total storage capacity for your Cloud project in your Adobe Commerce on cloud infrastructure contract and on your account page. Each project card in your account shows the number of environments, the storage capacity in GB, and the number of users. Alternatively, you can use the following Cloud command:

magento-cloud subscription:info | grep storage

Sample response:

| storage              | 51200

When a Pro production or staging environment reaches or exceeds 95% of the storage capacity, the cloud infrastructure monitoring tool triggers a support alert notifying you of an automatic increase in storage capacity.

Example notification:

“Our monitoring has detected files storage on your cluster (project-id-environment) is nearing full. The disk usage is currently at critical usage levels with less than 1 GiB left. The shared storage volume is currently being upsized from 60 GiB to 70 GiB to keep your services up and running. Please take a look at the production and staging files usage to see if you can clear up some space.”

TIP
It is recommended that you regularly monitor your storage capacity and maintain it well under 90% to avoid these automatic increases. Once allocated, the storage increase for Pro staging and production cannot be reverted.

Check integration environment

You can check disk space usage for your integration environment using the magento-cloud CLI.

To check approximate disk space usage:

magento-cloud db:size

Sample response:

Checking database service mysql...

+----------------+-----------------+--------+
| Allocated disk | Estimated usage | % used |
+----------------+-----------------+--------+
| 2.0 GiB        | 193.3 MiB       | ~ 9%   |
+----------------+-----------------+--------+

All the mounts share a disk. You can check disk space usage for mounts using the magento-cloud CLI.

To check approximate disk space usage for mounts:

magento-cloud mount:size

Sample response:

Checking disk usage for all mounts on <project>-<environment>-mymagento@ssh.us.magento.cloud...

+------------+-----------+---------+-----------+-----------+--------+
| Mount(s)   | Size(s)   | Disk    | Used      | Available | % Used |
+------------+-----------+---------+-----------+-----------+--------+
| app/etc    | 184 KiB   | 1.9 GiB | 481.3 MiB | 1.4 GiB   | 24.7%  |
| pub/media  | 128 KiB   |         |           |           |        |
| pub/static | 158.2 MiB |         |           |           |        |
| var        | 316.7 MiB |         |           |           |        |
+------------+-----------+---------+-----------+-----------+--------+

Check dedicated clusters

For Pro Staging and Production environments, you can check disk space usage in each environment using the disk free command, which reports the amount of disk space used by the file system. You must use SSH to log in to a remote environment.

df -h

The -h option displays the report using a human-readable format (KB, MB, or GB).

In the following sample response, the /mnt/shared mount shows the disk space for media and /data/mysql/ mount shows disk space for the database:

Filesystem                                    Size  Used Avail Use% Mounted on
udev                                           16G     0   16G   0% /dev
tmpfs                                         3.2G  9.1M  3.2G   1% /run
/dev/xvda1                                     59G  8.9G   48G  16% /
tmpfs                                          16G   36K   16G   1% /dev/shm
tmpfs                                         5.0M     0  5.0M   0% /run/lock
tmpfs                                          16G     0   16G   0% /sys/fs/cgroup
/dev/xvdj                                     9.8G  2.3G  7.6G  23% /data/mysql
/dev/xvdi                                     9.8G  491M  9.3G   5% /data/exports
192.168.5.5:/shared                           9.8G  591M  9.3G   6% /mnt/shared
/dev/loop0                                     91M   91M     0 100% /app/project
192.168.5.5:/shared/project/var         9.8G  591M  9.3G   6% /app/project/var
192.168.5.5:/shared/project/app/etc     9.8G  591M  9.3G   6% /app/project/app/etc
192.168.5.5:/shared/project/pub/media   9.8G  591M  9.3G   6% /app/project/pub/media
192.168.5.5:/shared/project/pub/static  9.8G  591M  9.3G   6% /app/project/pub/static

You can limit the response by specifying a directory. For example:

df -h var/

Sample response:

Filesystem                                    Size  Used Avail Use% Mounted on
192.168.5.5:/shared/project/var         9.8G  591M  9.3G   6% /app/project/var

Allocate disk space

Two configuration files control the allocation of disk space in the Cloud environments: the .magento.app.yaml file and the .magento/services.yaml file. Each file contains the disk property, which defines the disk size value in MB for the respective configuration. You can only change disk space allocation on Pro integration and Starter environments.

IMPORTANT
For Pro Production and Staging environments, you must Submit an Adobe Commerce Support ticket to change disk space allocation. A size increase of Pro Production and Staging environments can only occur at certain intervals, so, depending on your current disk space usage, support might recommend increasing disk space allocation by a minimum of 10 GB. Once allocated, the storage increase for Pro staging and production cannot be reverted.

Application disk space

The .magento.app.yaml file controls the persistent disk space available to the application.

To increase disk space for your application:

  1. In your local development environment, open the .magento.app.yaml configuration file.

  2. Set a new value for the disk property (in MB).

    code language-yaml
    disk: <value-mb>
    
  3. Save changes in the file.

  4. Add, commit, and push your code changes.

    code language-bash
    git add .magento.app.yaml && git commit -m "Increase disk space for application" && git push origin <branch-name>
    

    The changes take effect after you push the updated YAML file to the remote environment.

Service disk space

The .magento/services.yaml file controls the disk space available to each service, such as MySQL and Redis.

To increase disk space for a service:

  1. In your local development environment, open the .magento/services.yaml configuration file.

  2. Add or find a service in the file. See more about configuring services.

  3. Set a new value for the disk property (in MB).

    code language-yaml
    <name>:
        type: <service-name>:<service-version>
        disk: <value-mb>
    
  4. Save changes in the file.

  5. Add, commit, and push your code changes.

    code language-bash
    git add .magento/services.yaml && git commit -m "Increase disk space for service" && git push origin <branch-name>
    

    The changes take effect after you push the updated YAML file to the remote environment.

Monitor disk space

On Pro Production environments, you can monitor disk space and other performance indicators using the Managed alerts for Adobe Commerce alert policy for New Relic. For details, see Monitor performance with Managed Alerts. For further guidance, see Best practices to resolve database performance issues.

No space left

The build cache can grow over time. If you receive a warning that states No space left on device, try clearing the build cache and redeploying:

magento-cloud project:clear-build-cache
05f2f56e-ac5d-4931-8cdb-764e60e16f26