# How to create a block storage volume

Source: https://docs.quake.ai/docs/block/how-to/create-volume
Markdown: https://docs.quake.ai/docs/block/how-to/create-volume.md

---

# How to create a block storage volume

Create a persistent block storage volume that you can attach to virtual machine instances. Volumes persist independently of instances; you can detach, reattach, and snapshot them at any time.

<PrerequisiteBlock methods={["console", "cli", "api"]} />

## Create a volume

<MethodTabs>
<Method label="Console">

The Console exposes these fields, top to bottom: **Name**, **Data Source Type**, **Volume Type**, **Capacity (GiB)**, and **Count**. There is no Description or Availability Zone field.

1. Go to **Storage** > **Volumes** and select **Create Volume** in the top-right toolbar. The page navigates to `/storage/volume/create`.
2. Provide a **Name**.
3. Set the **Data Source Type**:
   - **Blank Volume**: creates a blank volume (the default)
   - **Image**: creates a volume pre-populated with an OS image
   - **Volume Snapshot**: creates a volume from an existing snapshot
4. The **Volume Type** picker is a single-row table. In `us-east-1`, **Flash_Premium** is the only type available and is auto-selected; keep it as-is.
5. Set the **Capacity (GiB)** using the slider or the numeric input. The slider is capped at `100 GiB` regardless of your remaining project quota; the default is `10 GiB`. To create a larger volume, use the CLI or API.
6. Set the **Count** to create multiple volumes at once (default `1`).
7. Select **Confirm**.

</Method>
<Method label="CLI">

Create a blank volume:

```bash
openstack volume create \
  --size 50 \
  my-volume
```

Create a volume from an image:

```bash
openstack volume create \
  --size 20 \
  --image "Ubuntu-24.04" \
  my-boot-volume
```

Create a volume from a snapshot:

```bash
openstack volume create \
  --size 50 \
  --snapshot SNAPSHOT_ID \
  my-restored-volume
```

</Method>
<Method label="API">

<BlockApiEnvPrereqs />

Create a blank volume:

```bash
curl -X POST "$OS_VOLUME_URL/volumes" \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "volume": {
      "name": "my-volume",
      "size": 50
    }
  }'
```

Create from an image:

```bash
curl -X POST "$OS_VOLUME_URL/volumes" \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "volume": {
      "name": "my-boot-volume",
      "size": 20,
      "imageRef": "IMAGE_ID"
    }
  }'
```

</Method>
</MethodTabs>

## Verify the volume

<MethodTabs>
<Method label="Console">

Go to **Storage** > **Volumes**. The volume appears with status **Available** when ready to attach.

</Method>
<Method label="CLI">

```bash
openstack volume show my-volume -c status -c size -c attachments
```

</Method>
<Method label="API">

```bash
curl -s "$OS_VOLUME_URL/volumes/VOLUME_ID" \
  -H "X-Auth-Token: $OS_TOKEN" | python3 -m json.tool
```

</Method>
</MethodTabs>

## Attach the volume to an instance

After creating the volume, attach it to a running instance:

<MethodTabs>
<Method label="Console">

<NoMoreButton />

1. Go to **Storage** > **Volumes**.
2. Find the volume in the list. On its row, open the **Volume action** icon dropdown (middle of the three per-row icons) and select **Attach**.
3. In the dialog, choose the target instance and confirm.

</Method>
<Method label="CLI">

```bash
openstack server add volume my-instance my-volume
```

The volume appears as a new block device inside the instance. Quake AI's libvirt driver uses virtio-scsi by default, so attached volumes show up as `/dev/sdX` (for example, `/dev/sdb`), not `/dev/vdX`. Format and mount the device before use.

</Method>
<Method label="API">

```bash
curl -X POST "$OS_COMPUTE_URL/servers/SERVER_ID/os-volume_attachments" \
  -H "X-Auth-Token: $OS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"volumeAttachment": {"volumeId": "VOLUME_ID"}}'
```

</Method>
</MethodTabs>

## See also

- [Volumes concepts](/docs/block/concepts/volumes)
- [Volumes console reference](/reference/block-storage/console/volumes)
- [Create a volume snapshot](/docs/block/how-to/create-snapshot)
- [Extend a volume](/docs/block/how-to/extend-volume)
