• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. API Reference
  4. Extension ECS APIs
  5. Disk Management
  6. Attaching a Disk to an ECS

Attaching a Disk to an ECS

Function

This interface is used to attach a disk to an ECS.

URI

POST /v1/{project_id}/cloudservers/{server_id}/attachvolume

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

server_id

Yes

Specifies the ECS ID.

Request

Parameter

Mandatory

Type

Description

volumeAttachment

Yes

Dict

Specifies the ECS attaching information.

Table 2 volumeAttachment field description

Parameter

Mandatory

Type

Description

volumeId

Yes

String

Specifies the ID of the disk to be attached. The value is in UUID format.

device

No

String

Specifies the device name, such as /dev/sda or /dev/sdb.

The new disk device name cannot be the same as an existing one.

This parameter is mandatory for XEN ECSs.

NOTE:

VBD disk device names can only be /dev/vdb through /dev/vdx. You are advised to attach the VBD disks in alphabetical order. Otherwise, the disk drive letters may be incorrect on the ECS.

Response

See Responses (Task).

Examples

  • Example request
    {
        "volumeAttachment": {
             "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
             "device": "/dev/sda"
        }
    }

Returned Values

See General Request Returned Values.

Error Code

See Error Code Description.