|
| 1 | +--- |
| 2 | +group: cloud-guide |
| 3 | +title: Manage disk space |
| 4 | +functional_areas: |
| 5 | + - Cloud |
| 6 | + - Storage |
| 7 | +--- |
| 8 | +You can find the total storage capacity for your Cloud project in your {{site.data.var.ece}} contract and on your [Magento account page](https://accounts.magento.cloud/user). Each project card in your account shows the number of _environments_, the _storage_ capacity in GB, and the number of _users_. |
| 9 | + |
| 10 | +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. |
| 11 | + |
| 12 | +```bash |
| 13 | +df -h |
| 14 | +``` |
| 15 | + |
| 16 | +The `-h` option displays the report using a human-readable format (KB, MB, or GB). |
| 17 | + |
| 18 | +Sample response: |
| 19 | + |
| 20 | +```terminal |
| 21 | +Filesystem Size Used Avail Use% Mounted on |
| 22 | +/dev/loop25 518M 518M 0 100% / |
| 23 | +tmpfs 12K 0 12K 0% /dev |
| 24 | +fake-sysfs 30G 0 30G 0% /sys |
| 25 | +tmpfs 30G 0 30G 0% /sys/fs/cgroup |
| 26 | +tmpfs 5.0M 0 5.0M 0% /dev/shm |
| 27 | +tmpfs 50M 324K 50M 1% /run |
| 28 | +tmpfs 5.0M 0 5.0M 0% /run/lock |
| 29 | +/dev/loop64 121M 121M 0 100% /app |
| 30 | +/dev/mapper/35xdpijwfe 2.0G 1.9G 0 100% /mnt |
| 31 | +/dev/mapper/platform-mxeox5xy 8.0G 141M 7.9G 2% /tmp |
| 32 | +/dev/mapper/platform-lxc 313G 13G 285G 5% /run/shared |
| 33 | +``` |
| 34 | + |
| 35 | +You can limit the response by specifying a directory. For example: |
| 36 | + |
| 37 | +```bash |
| 38 | +df -h var/ |
| 39 | +``` |
| 40 | + |
| 41 | +Sample response: |
| 42 | + |
| 43 | +```terminal |
| 44 | +Filesystem Size Used Avail Use% Mounted on |
| 45 | +/dev/mapper/35xdpijwfe 2.0G 1.9G 0 100% /app/var |
| 46 | +``` |
| 47 | + |
| 48 | +For the database, you can use the {{ site.data.var.ece }} CLI to check approximate disk space usage: |
| 49 | + |
| 50 | +```bash |
| 51 | +magento-cloud db:size |
| 52 | +``` |
| 53 | + |
| 54 | +Sample response: |
| 55 | + |
| 56 | +```terminal |
| 57 | +Checking database service mysql... |
| 58 | +
|
| 59 | ++----------------+-----------------+--------+ |
| 60 | +| Allocated disk | Estimated usage | % used | |
| 61 | ++----------------+-----------------+--------+ |
| 62 | +| 2.0 GiB | 193.3 MiB | ~ 9% | |
| 63 | ++----------------+-----------------+--------+ |
| 64 | +``` |
| 65 | + |
| 66 | +## Allocating disk space |
| 67 | + |
| 68 | +Two configuration files control the allocation of disk space in the Integration environment: 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. |
| 69 | + |
| 70 | +### Application disk space |
| 71 | + |
| 72 | +The `.magento.app.yaml` file controls the [persistent disk space]({{page.baseurl}}/cloud/project/project-conf-files_magento-app.html#disk) available to the Magento application. |
| 73 | + |
| 74 | +{:.procedure} |
| 75 | +To increase disk space for your application: |
| 76 | + |
| 77 | +1. In your local development environment, open the `.magento.app.yaml` configuration file. |
| 78 | + |
| 79 | +1. Set a new value for the `disk` property (in MB). |
| 80 | + |
| 81 | + ```yaml |
| 82 | + disk: <value-mb> |
| 83 | + ``` |
| 84 | +
|
| 85 | +1. Save changes in the file. |
| 86 | +
|
| 87 | +1. Add, commit, and push your code changes. |
| 88 | +
|
| 89 | + ```bash |
| 90 | + git add -A && git commit -m "Increase disk space for application" && git push magento <branch-name> |
| 91 | + ``` |
| 92 | + |
| 93 | + The changes take effect after you push the updated YAML file to the remote environment. |
| 94 | + |
| 95 | +### Service disk space |
| 96 | + |
| 97 | +The `.magento/services.yaml` file controls the disk space available to each service, such as MySQL and Redis. |
| 98 | + |
| 99 | +{:.procedure} |
| 100 | +To increase disk space for a service: |
| 101 | + |
| 102 | +1. In your local development environment, open the `.magento/service.yaml` configuration file. |
| 103 | + |
| 104 | +1. Add or find a service in the file. See [more about configuring services]({{page.baseurl}}/cloud/project/project-conf-files_services.html). |
| 105 | + |
| 106 | +1. Set a new value for the disk property (in MB). |
| 107 | + |
| 108 | + ```yaml |
| 109 | + <name>: |
| 110 | + type: <service-name>:<service-version> |
| 111 | + disk: <value-mb> |
| 112 | + ``` |
| 113 | +
|
| 114 | +1. Save changes in the file. |
| 115 | +
|
| 116 | +1. Add, commit, and push your code changes. |
| 117 | +
|
| 118 | + ```bash |
| 119 | + git add -A && git commit -m "Increase disk space for service" && git push magento <branch-name> |
| 120 | + ``` |
| 121 | + |
| 122 | + The changes take effect after you push the updated YAML file to the remote environment. |
| 123 | + |
| 124 | +## No space left |
| 125 | + |
| 126 | +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: |
| 127 | + |
| 128 | +```bash |
| 129 | +magento-cloud project:clear-build-cache |
| 130 | +``` |
0 commit comments