Attaching a Vultr Block Storage volume to a Vultr Cloud Compute instance allows the instance to discover the new storage device. You can then mount the volume to the file system to expand storage. Ensure the Vultr Block Storage volume and the Vultr Cloud Compute instance are in the same region before attaching the volume. You can also remove the attachment if you no longer wish to associate the volume with the instance.
Follow this guide to manage attachments for Vultr Block Storage volume using the Vultr Customer Portal, Vultr API, and Vultr CLI.
Navigate to Products and select Cloud Storage.
Click Block Storage. Then, select the target Vultr Block Storage volume.
Navigate to Attach to: and select the Cloud Compute instance.
Confirm that you want to attach the Block Storage volume.
Click Detach if you want to remove the Block Storage volume from the Vultr Cloud Compute instance.
Send a GET
request to the List Block Storages endpoint and note the Vultr Block Storage volume ID
.
$ curl "https://api.vultr.com/v2/blocks" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a GET
request to the List Cloud Compute Instances endpoint and note the Vultr Cloud Compute instance ID
.
$ curl "https://api.vultr.com/v2/instances" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a POST
request to the Attach Block Storage endpoint, specify a Vultr Block Storage volume ID and a Vultr Cloud Compute instance ID. Then, specify the "live" : true
option to attach the volume without restarting the Vultr Cloud Compute instance.
$ 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
}'
Send a POST
request to the Detach Block Storage endpoint to detach the Block Storage volume from the Vultr Cloud Compute instance.
$ 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.
List all Vultr Block Storage volumes and note the ID of the target volume. For instance, 6856bb78-e67b-416c-8fc1-2473c66fa016
.
$ vultr-cli block-storage list
List all Vultr Cloud Compute instances and note the instance ID. For instance, 6cd130db-ae61-4995-8f44-7c57daa532fe
.
$ vultr-cli instance list
Attach the volume to the instance by specifying the Vultr Block Storage volume ID and Vultr Cloud Compute instance ID.
$ vultr-cli block-storage attach block_storage_id \
--instance instance_id
Detach a Vultr Block Storage volume from a Vultr Cloud Compute instance by specifying the Vultr Block Storage volume ID.
$ vultr-cli block-storage detach block_storage_id
Run vultr-cli block-storage detach --help
to view all options.