> For the complete documentation index, see [llms.txt](https://docs.glesys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glesys.com/products/storage/block-storage/how-tos/attach-a-volume-to-a-virtual-machine.md).

# Attach a volume to a virtual machine

You can attach any volume to any KVM virtual machine, but there's an upper limit of 25 drives per VM. A block storage volume can only be attached to one virtual machine at a time.

***

You can attach a volume to a VM from either the block storage overview or the virtual machine overview.

## Attach a volume from the block storage overview

Navigate to **Storage → Block storage** in the left-hand menu. Click on the volume you want to attach.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FoLIghuxpKmORHTs6xJmi%2Fblock-storage-attach1.png?alt=media&amp;token=51e26108-5986-44ba-9fe8-cc2acb781d87" alt=""><figcaption></figcaption></figure>

Click **Attach** at the bottom of the volume's overview.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FkzYGWlcEE8FVycuQ2GLF%2Fblock-storage-attach2.png?alt=media&amp;token=ec99fae2-d8e5-4215-800f-02a797975572" alt=""><figcaption></figcaption></figure>

Select the virtual machine you want to attach the volume to and click **Attach**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FJaAlH5CutPcjBEWIDvWA%2Fblock-storage-attach3.png?alt=media&amp;token=2b89d540-bb6d-454b-a8b5-18655166ea14" alt=""><figcaption></figcaption></figure>

Once the volume is attached to a virtual machine, you'll see which VM it's attached to and its WWN. The WWN (World Wide Name) is a unique identifier for the volume that's also shown inside the operating system. Use the WWN to match the volume in the control panel to the volume inside the operating system when performing operations on it, such as formatting and mounting it. This helps you avoid operating on the wrong volume.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FsW2o4zGYRjDPOGprAjCk%2Fblock-storage-attached.png?alt=media&amp;token=15c1ed4f-c264-4134-b471-d606edb7c596" alt=""><figcaption></figcaption></figure>

## Attach a volume from the VM overview

You can also attach a volume from the VM's overview page. Navigate to **Compute → Virtual machines** and click on the VM you want to attach a volume to.

Click on the **Block storage** tab. Click **Attach block storage**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2F48NUGzS3yIeNuBDAy83I%2Fkvm-vm-block-storage-attach.png?alt=media&amp;token=1492fbad-15e3-4d8e-92ff-404986cbffd2" alt=""><figcaption></figcaption></figure>

Select the volume you want to attach to this VM and click **Attach**.

<figure><img src="https://3379166260-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMZhhdQNcWOpX5Bj48GK%2Fuploads%2FyKyWGOb441lCt0crmaun%2Fkvm-vm-block-storage-attach2.png?alt=media&amp;token=aba11950-e733-498e-9f78-cab41ab7a683" alt=""><figcaption></figcaption></figure>

## Attach a volume using the API

Use the [blockstorage/attach](https://github.com/GleSYS/API-docs/wiki/API-Documentation#blockstorageattach) endpoint to attach a volume using the [API](https://docs.glesys.com/platform/control-panel/api.md).
