How to Manage Attachments for Vultr Block Storage

Updated on September 25, 2024

Attaching Vultr Block Storage to a Cloud Compute instance allows the instance to discover the new storage device. You can then mount the block storage to the file system to expand storage. Ensure the Vultr Block Storage and Cloud Compute instances are in the same region before attaching the storage. You can also remove the attachment if you no longer wish to associate the storage with the Cloud Compute instance.

Follow this guide to manage attachments for Vultr Block Storage using the Vultr Customer Portal, Vultr API, and Vultr CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and select Cloud Storage.

  2. Click Block Storage. Then, select the target block storage instance.

    Block Storage List

  3. Navigate to Attach to: and select the Cloud Compute instance.

    Attach Block Storage

  4. Confirm that you want to attach the block storage instance.

    Block Storage Confirmation

  5. Click Detach if you want to remove the block storage instance from the instance.

    Detach Block Storage

  1. Send a GET request to the List Block Storages endpoint and note the block storage ID.

    console
    $ curl "https://api.vultr.com/v2/blocks" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send a GET request to the List Cloud Compute Instances endpoint and note the instance ID.

    console
    $ curl "https://api.vultr.com/v2/instances" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  3. Send a POST request to the Attach Block Storage endpoint, specify a block storage ID and a Cloud Compute instance ID. Then, specify the "live" : true option to attach the volume without restarting the cloud compute instance.

    console
    $ curl "https://api.vultr.com/v2/blocks/block_storage_id/attach" \
        -X POST \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json" \
        --data '{
            "instance_id" : "cloud_compute_instance_id",
            "live" : true
        }'
    
  4. Send a POST request to the Detach Block Storage endpoint to detach the block storage instance from the cloud compute instance.

    console
    $ curl "https://api.vultr.com/v2/blocks/block_storage_id/detach" \
        -X POST \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json" \
        --data '{
            "live" : true
        }'
    

    Visit the Detach Block Storage endpoint to view additional attributes to add to your request.

  1. List all block storage instances and note the object storage ID. For instance, 6856bb78-e67b-416c-8fc1-2473c66fa016.

    console
    $ vultr-cli block-storage list
    
  2. List all cloud compute instances and note the instance ID. For instance, 6cd130db-ae61-4995-8f44-7c57daa532fe.

    console
    $ vultr-cli instance list
    
  3. Attach the block storage to the instance by specifying a block storage ID and an instance ID.

    console
    $ vultr-cli block-storage attach block_storage_id \
    --instance instance_Id
    
  4. Detach the block storage from the instance by specifying a block storage ID.

    console
    $ vultr-cli block-storage detach block_storage_id
    

    Run vultr-cli block-storage detach --help to view all options.