# disk


An ``integer`` (or ``null``) that defines the disk space allocated (in MB) to an app.

Optional in [single-runtime](https://fixed.docs.upsun.com/create-apps/app-reference/single-runtime-image.md#top-level-properties) and [composable](https://fixed.docs.upsun.com/create-apps/app-reference/composable-image.md#top-level-properties) images. 

The maximum total space available to all apps and services is set by the storage in your plan settings.
When deploying your project, the sum of all `disk` keys defined in app and service configurations
cannot exceed the available storage in your plan.

So if your *plan storage size* is 5 GB, you can, for example, assign it in one of the following ways:

- 2 GB to your app, 3 GB to your database
- 1 GB to your app, 4 GB to your database
- 1 GB to your app, 1 GB to your database, 3 GB to your OpenSearch service

If you exceed the total space available, you receive an error on pushing your code.
You need to either increase your plan's storage or decrease the `disk` values you've assigned.

You configure the disk size in [MB](https://fixed.docs.upsun.com/glossary.md#mb). Your actual available disk space is slightly smaller with some space used for formatting and the filesystem journal. When checking available space, note whether it’s reported in MB or MiB.

If you need more storage to fit the sum of all `disk` keys, it is necessary to [switch plans](https://fixed.docs.upsun.com/administration/pricing.md#switch-plans). This can only be done by people with the [manage plans permission](https://fixed.docs.upsun.com/administration/users.md#organization-permissions).

### Backups and altering `disk` values

It's a best practice to [back up your environment](https://fixed.docs.upsun.com/environments/backup.md) **before and after** you increase **or** decrease the `disk` value (the amount of allocated storage space) of an app or service.

You can decrease the size of an existing disk for an app. If you do so, be aware that:
- Downsizing fails if the amount of  data exceeds the configured `disk` value. 
- Backups completed before the downsizing a disk are incompatible  and can no longer be used to restore applications. You need to [create new backups](https://fixed.docs.upsun.com/environments/backup.md).

