Volumes

Volume Attach

post
https://api.linode.com/v4/volumes/{volumeId}/attach

Attaches a Volume on your Account to an existing Linode on your Account. In order for this request to complete successfully, your User must have read_write permission to the Volume and read_write permission to the Linode. Additionally, the Volume and Linode must be located in the same Region.

Path Parameters

volumeId
Required
integer

ID of the Volume to attach.

Request Body Schema

linode_id
Required
integer

The ID of the Linode to attach the volume to.

config_id
integer

The ID of the Linode Config to include this Volume in. Must belong to the Linode referenced by linode_id. If not given, the last booted Config will be chosen.

persist_across_boots
boolean

Defaults to true, if false is provided, the Volume will not be attached to the Linode Config. In this case more than 8 Volumes may be attached to a Linode if a Linode has 16GB of RAM or more. The number of volumes that can be attached is equal to the number of GB of RAM that the Linode has, up to a maximum of 64. config_id should not be passed if this is set to false and linode_id must be passed. The Linode must be running.

Request Samples

curl -H "Content-Type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -X POST -d '{
      "linode_id": 12346,
      "config_id": 23456
    }' \
    https://api.linode.com/v4/volumes/12345/attach

Response Samples

{
  "status": "active",
  "created": "2018-01-01T00:01:01",
  "updated": "2018-01-01T00:01:01",
  "id": 1234,
  "label": "my-volume",
  "region": "us-east",
  "tags": [],
  "size": 30,
  "linode_id": 12346,
  "filesystem_path": "/dev/disk/by-id/scsi-0Linode_Volume_my-volume",
  "linode_label": "linode123",
  "hardware_type": "nvme"
}

Responses

200: Volume was attached to a Linode.

status
string
Enum: "creating""active""resizing"

The current status of the volume. Can be one of:

  • creating - the Volume is being created and is not yet available for use.
  • active - the Volume is online and available for use.
  • resizing - the Volume is in the process of upgrading its current capacity.
created
string <date-time>

When this Volume was created.

updated
string <date-time>

When this Volume was last updated.

id
integer

The unique ID of this Volume.

label
Filterable
string [1 .. 32] characters ^[a-zA-Z]((?!--|__)[a-zA-Z0-9-_])+$

The Volume's label is for display purposes only.

region
string

The unique ID of this Region.

tags
Filterable
array of objects

An array of Tags applied to this object. Tags are for organizational purposes only.

size
integer

The Volume's size, in GiB.

linode_id
Nullable
integer

If a Volume is attached to a specific Linode, the ID of that Linode will be displayed here.

filesystem_path
string

The full filesystem path for the Volume based on the Volume's label. Path is /dev/disk/by-id/scsi-0LinodeVolume + Volume label.

linode_label
Nullable
string

If a Volume is attached to a specific Linode, the label of that Linode will be displayed here.

hardware_type
string
Enum: "hdd""nvme"

The storage type of this Volume.

default: Error

errors
array of objects
reason
string

What happened to cause this error. In most cases, this can be fixed immediately by changing the data you sent in the request, but in some cases you will be instructed to open a Support Ticket or perform some other action before you can complete the request successfully.

field
string

The field in the request that caused this error. This may be a path, separated by periods in the case of nested fields. In some cases this may come back as "null" if the error is not specific to any single element of the request.