> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# FAQ: Storage

**Note:**

Some answers on this page apply to Atlas Core clusters only. To learn which features Atlas Infinite supports, see [Public Preview Availability.](https://www.mongodb.com/docs/atlas/infinite/atlas-infinite-landing.md#std-label-atlas-infinite-availability)

## What happens when I reach my Atlas storage limit?

The result of reaching your Atlas storage limit depends on the Atlas cluster you are using.

- For Free clusters (formerly known as `M0`) and Flex clusters, the maximum storage is a hard limit and cannot be exceeded. You can add additional storage by upgrading to a dedicated cluster (`M10+`). For details on how Atlas calculates storage limits for Flex clusters, see [this section](https://www.mongodb.com/docs/atlas/reference/faq/storage.md#std-label-faq-caluculate-flex-storage-limit) of the FAQ.

- By default, `M10+` clusters [auto-expand storage](https://www.mongodb.com/docs/atlas/scale-cluster.md#std-label-scale-cluster-storage) based on disk usage thresholds. To modify this setting to a fixed storage limit, refer to the [Modify an Atlas Core Cluster](https://www.mongodb.com/docs/atlas/scale-cluster.md#std-label-scale-cluster-storage) page.

If you attempt to write to a Flex cluster that does not have space for the desired write operation, Atlas displays an error message similar to the following:

```javascript
WriteResult({
  "writeError": {
    "code": 8000,
    "errmsg": "you are over your space quota, using 513 MB of 512 MB"
  }
})
```

**See also:**

To learn about the differences between Flex clusters and dedicated clusters, see [Atlas Flex Limits.](https://www.mongodb.com/docs/atlas/reference/flex-limitations.md#std-label-flex-cluster-limitations)

**Tip:**

You can configure alerts which trigger once your allocated storage reaches a specified threshold. Atlas calculates allocated storage using metrics returned by the [`dbStats`](https://www.mongodb.com/docs/manual/reference/command/dbStats.md#mongodb-dbcommand-dbcmd.dbStats) command.

Atlas retrieves database metrics every 20 minutes by default but adjusts frequency when necessary to reduce the impact on database performance.

To learn more about storage alerts, see [DB Storage alert conditions.](https://www.mongodb.com/docs/atlas/reference/alert-conditions.md#std-label-db-storage-alerts)

### How does Atlas calculate storage limits for Flex Clusters?

Atlas calculates the storage limit for Flex clusters based on data usage, as opposed to the `storageSize` metric used by non-Flex clusters (which includes compression). Atlas determines data usage by summing a cluster's `dataSize` and `indexSize`.  You can issue the [db.stats()](https://www.mongodb.com/docs/manual/reference/method/db.stats/) method to view the values of these fields.

## Without using Provisioned IOPS on MongoDB Atlas on AWS, what kind of IOPS should I expect?

Atlas provides an estimate of how many 16K IOPS (Input/Output Operations per Second) you can expect, calculated as the lesser of 3 IOPS (Input/Output Operations per Second) per provisioned GB, or the cluster node's maximum IOPS (Input/Output Operations per Second) capacity.

## Can I change a cluster's IOPS (Input/Output Operations per Second) rate without changing storage capacity?

Yes, for Gen2 Dedicated clusters hosted on either AWS (Amazon Web Services) or Google Cloud you can change a cluster's IOPS (Input/Output Operations per Second) rate without changing storage capacity. Gen2 Dedicated clusters offer improved performance compared to Gen1 clusters and support Extended Standard IOPS (Input/Output Operations per Second), offering the following benefits:

- Optimized price performance.

- Newer hardware that enables long-term growth and avoids capacity restraints from older hardware.

- Independent scaling of your cluster's standard IOPS (Input/Output Operations per Second) and storage capacity with increased maximum standard IOPS (Input/Output Operations per Second) rates:

  - `80k` IOPS (Input/Output Operations per Second) for AWS (Amazon Web Services)

  - `160k` IOPS (Input/Output Operations per Second) for Google Cloud

You can select Gen2 when configuring tier `M30+` clusters on AWS (Amazon Web Services) or Google Cloud. To learn more, see:

- [Gen2 Dedicated Clusters](https://www.mongodb.com/docs/atlas/manage-clusters.md#std-label-gen2-clusters)

- [IOPS Types](https://www.mongodb.com/docs/atlas/customize-storage.md#std-label-storage-iops-ui)

## What should I expect when I switch a cluster to Gen2?

Switching a cluster between generations behaves like any other cluster tier change. You change the generation the same way that you change the cluster tier. To learn more, see [Change a Cluster's Generation.](https://www.mongodb.com/docs/atlas/cluster-config/change-cluster-generation.md#std-label-change-gen2-cluster-generation)

## What happens to my IOPS (Input/Output Operations per Second) when I switch a cluster to Gen2?

Atlas maintains your existing IOPS (Input/Output Operations per Second) rate when you switch a cluster from Gen1 to Gen2.

For Gen2 clusters hosted on AWS (Amazon Web Services), Atlas also keeps your existing IOPS (Input/Output Operations per Second) type:

- If your Gen1 cluster uses Provision IOPS, the Gen2 cluster uses High Performance IOPS.

- If your Gen1 cluster doesn't use Provision IOPS, the Gen2 cluster uses Standard IOPS.

We don't recommend changing your cluster's generation and IOPS (Input/Output Operations per Second) type at the same time. Instead, change one feature and confirm your cluster performs as expected before changing the other. To learn how to configure standard IOPS (Input/Output Operations per Second) on Gen2, see [Extended Standard IOPS for Gen2 Clusters.](https://www.mongodb.com/docs/atlas/customize-storage.md#std-label-config-ext-standard-gen2-iops)

## What happens to my IOPS (Input/Output Operations per Second) if I switch my cluster back to Gen1?

For clusters hosted on AWS (Amazon Web Services), Atlas preserves your existing IOPS (Input/Output Operations per Second) type when you switch a cluster back to Gen1. Standard IOPS (Input/Output Operations per Second) stays as Standard IOPS (Input/Output Operations per Second), and High Performance IOPS (Input/Output Operations per Second) stays as High Performance IOPS (Input/Output Operations per Second). Atlas also checks your Gen2 configuration against the IOPS (Input/Output Operations per Second).

Atlas also checks your Gen2 configuration against the Gen1 configuration limits. If the move to Gen1 would breach a Gen1 limit, Atlas automatically reduces your IOPS (Input/Output Operations per Second) to meet the Gen1 limit. For example, Gen1 clusters hosted on AWS (Amazon Web Services) support a maximum of 16,000 IOPS (Input/Output Operations per Second), so Atlas automatically reduces a Gen2 cluster of 16,000 IOPS (Input/Output Operations per Second). If a Gen2 cluster uses more than 16,000 IOPS (Input/Output Operations per Second), Atlas automatically reduces the cluster to 16,000 IOPS (Input/Output Operations per Second) when you switch it to Gen1. If moving to Gen1 would result in fewer IOPS (Input/Output Operations per Second), Atlas displays a warning and requires you to confirm that the available IOPS (Input/Output Operations per Second) are sufficient for your workload before proceeding.

## What's the difference between standard and High Performance IOPS (Input/Output Operations per Second) on Gen2 clusters hosted on AWS (Amazon Web Services)?

Standard IOPS (Input/Output Operations per Second) use AWS (Amazon Web Services) General Purpose SSD volumes instead of the AWS (Amazon Web Services) Provisioned IOPS SSD volumes that High Performance IOPS (Input/Output Operations per Second) use, so they don't deliver the same latency or consistency characteristics. If your workload is sensitive to write latency or depends on a consistent IOPS (Input/Output Operations per Second) rate, test the change in a non-production environment before you apply it to production.

Provisioned IOPS on Gen1 and High Performance
IOPS on Gen2 refer to the same concept. To learn how the IOPS (Input/Output Operations per Second) types differ, see [IOPS Types.](https://www.mongodb.com/docs/atlas/customize-storage.md#std-label-storage-iops-ui)

## Does switching a cluster to Gen2 change my costs?

Yes, both the generation change and any change to the IOPS (Input/Output Operations per Second) type or rate affect cost. To estimate the cost of each change before you apply it, use the cluster builder in the Atlas UI.

On Gen2, you configure standard IOPS (Input/Output Operations per Second) and storage capacity independently, and Atlas bills them separately. You can adjust each one to match your workload and optimize your costs. To learn how Atlas bills Gen2 Dedicated clusters, see [Gen2 Dedicated clusters.](https://www.mongodb.com/docs/atlas/billing/cluster-configuration-costs.md#std-label-gen2-clusters-billing)

## Can I configure a cluster with more storage than the standard limit for the cluster tier?

For clusters that meet specific criteria, yes. To learn which clusters support extended storage and how to enable this for your projects, see [Manage Project Settings.](https://www.mongodb.com/docs/atlas/tutorial/manage-project-settings.md#std-label-project-settings)

## How can I reduce storage usage on a cluster?

You can use the `autoCompact` command on dedicated clusters to perform background compaction, which reduces your storage use. This command automatically iterates through available files and continuously attempts to release unneeded disk space to the operating system. To learn more about enabling the `autoCompact` privilege action, see [Built-In Roles](https://www.mongodb.com/docs/manual/reference/built-in-roles.md#std-label-atlas-specific-privileges) in the "Built-In Roles and Privileges" section.

The `autoCompact` command is supported only on dedicated clusters running MongoDB 8.0+.

To run `autoCompact` on a cluster, do the following steps:

1. Create a database user and configure the `autoCompact` privilege.

2. (*Optional*) If you are connecting to a sharded cluster, retrieve the connection string of each node in the sharded cluster. You can use an [Atlas Administration API endpoint](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getgroupcluster) to retrieve this information.

3. Connect to each node that you want to run `autoCompact` on.

4. Run `autoCompact` on the `admin` database.
