Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Attaching a Disk to an ECS

Updated on 2024-12-19 GMT+08:00

Function

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

This API is an asynchronous API. After the attachment request is successfully delivered, a job ID is returned. This does not mean the attachment is complete. You need to call the API by referring to Querying Task Execution Status to query the job status. The SUCCESS status indicates that the attachment is successful.

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.

For details about how to obtain the ID, see Obtaining a Project ID.

server_id

Yes

Specifies the ECS ID.

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

volumeAttachment

Yes

Object

Specifies the ECS attachment information. For details, see Table 3.

dry_run

No

Boolean

Specifies whether to check the request and attach the disk.

  • true: indicates that only the request is sent, and no disk will be attached. Check items include mandatory parameters, request format, and service restrictions. If the check fails, the system returns an error. If the check result is as expected, the system properly responds.
  • false: indicates that only the request is sent and the disk will be attached if the check result is as expected.

The default value is false.

Table 3 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

Indicates the disk device name.

NOTE:
  • The new disk device name cannot be the same as an existing one.
  • This parameter is mandatory for Xen ECSs. Set the parameter value to /dev/sda for the system disks of such ECSs and to /dev/sdx for data disks, where x is a letter in alphabetical order. For example, if there are two data disks, set the device names of the two data disks to /dev/sdb and /dev/sdc, respectively. If you set a device name starting with /dev/vd, the system uses /dev/sd by default.
  • For KVM ECSs, set the parameter value to /dev/vda for system disks. The device names for data disks of KVM ECSs are optional. If the device names of data disks are required, set them in alphabetical order. For example, if there are two data disks, set the device names of the two data disks to /dev/vdb and /dev/vdc, respectively. If you set a device name starting with /dev/sd, the system uses /dev/vd by default.
  • For ECSs that only support SCSI disks, set the device name of the system disk to /dev/sda and the device names of data disks in alphabetical order, for example, /dev/sdb and /dev/sdc. The system will not change the default device names.

volume_type

No

String

Specifies the disk type.

If volumeId is unavailable and dry_run is set to true, volume_type is available and must be specified.

count

No

Integer

Specifies the number of disks.

If volumeId is unavailable and dry_run is set to true, count is available. If count is unavailable, the number of disks is 1 by default.

hw:passthrough

No

String

  • If this parameter is set to true, the disk device type is SCSI, which allows ECS OSs to directly access the underlying storage media. SCSI reservation commands are supported.
  • If this parameter is set to false, the disk device type is VBD, which supports only simple SCSI read/write commands.

If volumeId is unavailable and dry_run is set to true, volume_type is available and must be specified.

Response

See Responses (Task).

Example Request

Attach a SCSI EVS disk to the device /dev/sda.

POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/attachvolume

{
    "volumeAttachment": {
         "volumeId": "a26887c6-c47b-4654-abb5-dfadf7d3f803",
         "device": "/dev/sda",
         "volume_type": "SSD",
         "count": 5,
         "hw:passthrough": "true"
    },
    "dry_run": false
}

Example Response

{
    "job_id": "ff80808288d41e1b018990260955686a"
}

Error Codes

See Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback