# Volumes

> Block storage mounted into an app target — sized, node-local or replicated, with snapshots

URL: https://pier.run/docs/resources/volumes

```yaml title="pier.yaml"
environments:
  prod:
    volumes:
      - name: data
        storage_gb: 5
        durability: ha            # standard (default) or ha; immutable after creation
    apps:
      - name: api
        targets:
          - name: primary
            volumes:
              - volume: data
                mount_path: /var/lib/app
```

```bash
pier ls volumes
```

```text title="output"
                                                                      
 NAME SIZE DURABILITY STATUS HEALTH BOUND TO                          
                                                                      
 data 1 GB standard   ready  -      app/api at /var/lib/app (pending) 
                                                                      

```

A volume is a disk. It is declared once in the environment and mounted into one app
target at a path; the data survives deploys, restarts and scale changes of that target.

## Configuration

| Key                                | Meaning                                                                                                |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `storage_gb`                       | Size; can grow, never shrink                                                                           |
| `durability`                       | `standard` — node-local, fastest, default; `ha` — replicated, survives a node failure. Set at creation |
| `targets[].volumes[]` (on the app) | `volume` and `mount_path`                                                                              |

## Commands

| Command                                                                                                                            | Does                   |
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| `pier add volume --name data --size 5GB --app api --mount /var/lib/app`, `pier set volume data --size 10GB`, `pier rm volume data` | declare, grow, remove  |
| `pier snapshots ls data`, `pier snapshots create data`                                                                             | snapshots              |
| `pier info data`, `pier monitor data`                                                                                              | binding, health, usage |

## Behaviour

* A volume mounts into one target at a time; an app with `replicas: 2` cannot share it.
* Adding or moving a binding rolls the target with its current image; no build runs.
* `ha` volumes keep serving through a node failure. `standard` volumes are tied to the
  node that holds them; they suit caches and data that can be rebuilt.
* A removed volume stays in [trash](/docs/concepts#trash) for 30 days with its data.

## Tasks

[Deploy an app](/docs/guides/deploy-an-app)
