全部產品
Search
文件中心

Elastic Compute Service:ResizeDisk - 擴容磁碟

更新時間:Apr 04, 2026

擴容一塊磁碟,支援擴容系統硬碟和資料盤。

介面說明

說明

擴容前,請務必查詢雲端硬碟採用的分區格式。如果是 MBR 格式,不支援擴容到 2TiB 以上,否則會造成資料丟失。對於 MBR 分區擴容,建議您重新建立並掛載一塊資料盤,採用 GPT 分區格式後,再將已有資料拷貝至新的資料盤上。更多詳情,請參見擴容雲端硬碟容量

  • 支援擴容的磁碟類型包括普通雲端硬碟(cloud)、高效雲端硬碟(cloud_efficiency)、SSD 雲端硬碟(cloud_ssd)、ESSD 雲端硬碟(cloud_essd)、ESSD AutoPL 雲端硬碟(cloud_auto)、彈性臨時盤-標準版(elastic_ephemeral_disk_standard)和彈性臨時盤-進階版(elastic_ephemeral_disk_premium)、 ESSD 同城冗餘雲端硬碟(cloud_regional_disk_auto)。

  • 正在建立快照的雲端硬碟不支援擴容。請您等待快照建立完成後,再開始執行擴容操作。

  • 該介面不能擴容分區和檔案系統,您需要在擴容雲端硬碟容量後自行分配分區和檔案系統,具體操作,請參見擴容分區與檔案系統(Linux)擴容分區與檔案系統(windows)

  • 開啟多重掛載特性的雲端硬碟支援線上擴容和離線擴容,請確保磁碟掛載的執行個體滿足以下條件:

    • 線上擴容時,執行個體狀態為運行中Running)。

    • 離線擴容時,執行個體狀態為運行中Running)或已停止Stopped)。

  • 請確保雲端硬碟滿足以下條件:

    • 雲端硬碟狀態為使用中(In Use)或者待掛載(Available)。

    • (強烈建議)已為雲端硬碟建立快照,做好資料備份。具體操作,請參見建立快照

    • 如果您是全新購買的資料盤,請先完成初始化再執行擴容操作。更多資訊,請參見初始化概述

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ResizeDisk

update

*Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

請求參數

名稱

類型

必填

描述

樣本值

DiskId

string

磁碟 ID。您可以調用 DescribeDisks 查詢磁碟 ID。

d-bp67acfmxazb4p****

Type

string

擴容磁碟的方式。取值範圍:

  • offline(預設):離線擴容。擴容後,您必須在控制台重啟執行個體或者調用 API RebootInstance 使操作生效。

  • online:線上擴容,無需重啟執行個體即可完成擴容。磁碟類型支援高效雲端硬碟、SSD 雲端硬碟、ESSD 雲端硬碟和彈性臨時盤。

offline

NewSize

integer

希望擴容到的磁碟容量大小。單位為 GiB。取值範圍:

  • 系統硬碟:

    • 普通雲端硬碟:20~500。

    • ESSD 雲端硬碟:
      • PL0:1~2048。

      • PL1:20~2048。

      • PL2:461~2048。

      • PL3:1261~2048。

    • ESSD AutoPL 雲端硬碟:1~2048。

    • 其他雲端硬碟類型:20~2048。

  • 資料盤:

    • 高效雲端硬碟(cloud_efficiency):20~32768。

    • SSD 雲端硬碟(cloud_ssd):20~32768。

    • ESSD 雲端硬碟(cloud_essd):具體取值範圍與PerformanceLevel的取值有關。可以調用 DescribeDisks 查詢雲端硬碟資訊,再根據查詢結果中的PerformanceLevel參數查看取值。
      • PL0:1~65536。

      • PL1:20~65536。

      • PL2:461~65536。

      • PL3:1261~65536。

    • 普通雲端硬碟(cloud):5~2000。

    • ESSD AutoPL 雲端硬碟(cloud_auto):1~65536。

    • 彈性臨時盤-標準版(elastic_ephemeral_disk_standard):64~8,192。

    • 彈性臨時盤-進階版(elastic_ephemeral_disk_premium):64~8,192。

說明

指定的新磁碟容量必須比原磁碟容量大,否則調用介面將報錯。

1900

ClientToken

string

保證請求等冪性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證等冪性

123e4567-e89b-12d3-a456-426655440000

返回參數

名稱

類型

描述

樣本值

object

OrderId

string

產生的訂單 ID。

說明

僅在擴容訂用帳戶雲端硬碟時會返回訂單 ID。

20413515388****

RequestId

string

請求 ID。

F3CD6886-D8D0-4FEE-B93E-1B732396****

樣本

正常返回樣本

JSON格式

{
  "OrderId": "20413515388****",
  "RequestId": "F3CD6886-D8D0-4FEE-B93E-1B732396****"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidDataDiskSize.ValueNotSupported The specified DataDisk.n.Size beyond the permitted range, or the capacity of snapshot exceeds the size limit of the specified disk category. 指定的 DataDisk.n.Size 超出允許範圍,或者快照的容量超過指定磁碟類別的大小限制。
400 InvalidParameter.Conflict %s 您輸入的參數無效,請檢查參數之間是否衝突。%s為變數,將根據調用API的實際情況動態返回錯誤資訊。
400 IncompleteParamter Some fields can not be null in this request. 請求中缺失參數。
400 InvalidRegionId.MalFormed The specified RegionId is not valid.
400 InvalidParam.Type The specified type is not supported. 指定的參數Type無效。
400 LastOrderProcessing The previous order is still processing, please try again later. 訂單正在處理中,稍後重試。
400 InvalidStatus.Upgrading The instance which the disk attachs is upgrading; please try again later.
400 InvalidSystemDiskSize.ImageNotSupportResize The image of the instance does not support resize.
400 InvalidDisk.DetachedSystemDisk The specified disk is a detached system disk, does not support this operation.
400 OperationDenied.NotEnoughCapacity The capacity of the current dedicated block storage cluster is not enough to expand.
400 IncorrectDiskStatus.ReplicationStatusNotFound Disk replication status not found.
400 IncorrectDiskStatus.InReplication Disk already in replication.
400 QuotaExceed.DiskCapacity The used capacity of disk type has exceeded the quota in the zone, %s. 指定磁碟類型的已用容量超出可用性區域配額限制,您可以前往配額中心查詢和申請提升磁碟容量配額。
400 NoPermission.Price The operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true. 該操作需要價格許可權。請向您的主賬戶申請許可權,或將參數AutoPay設定為true進行自動支付。
400 NoPermission.Refund The operation requires refund permission. Please apply for permission from your main account. 該帳號無許可權操作退款,主帳號需要授權退款相關許可權。
400 InvalidOperation.InstanceRenewWithDowngradeInPlan The operation is denied due to the specified instance has renew with downgrade record in plan. 存在未生效的續約降配訂單。訂單生效前不允許此操作。
400 InvalidSystemDiskSize.ValueNotSupported The specified system disk size is invalid. 無效的系統硬碟大小。
400 OperationDenied.UnfinishedOrder The current instance has unfinished refundOrder, this operation is denied. 執行個體存在未完成的退款訂單,請耐心等待,稍後重試。
400 AccountForbidden.CreateOrder Order cannot be created due to abnormal account. 當前帳號不允許建立訂單。
500 InternalError The request processing has failed due to some unknown error.
403 InvalidDataDiskSize.ValueNotSupported The specified DataDisk.n.Size beyond the permitted range, or the capacity of snapshot exceeds the size limit of the specified disk category.
403 OperationDenied The type of the disk does not support the operation. 此磁碟種類不支援指定的操作。
403 InvalidDiskSize.TooSmall Specified new disk size is less than the original disk size.
403 InvalidDiskSize.TooLarge Specified new disk size is beyond the permitted range.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 DiskError Incorrect disk status.
403 DiskInArrears The specified operation is denied as your disk owing fee.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet.
403 InvalidDiskSize Specified new disk size is less than or equal the original disk size. 指定的新磁碟大小必須大於原始磁碟大小。
403 Operation.Conflict The operation may conflicts with others.
403 InstanceLockedForSecurity The instance is locked due to security. 您的資源被安全鎖定,拒絕操作。
403 IncorrectDiskStatus The current disk status does not support this operation.
403 UserNotInTheWhiteList The user is not in disk white list. 您不在磁碟白名單中,請加入白名單後重試。
403 InvalidDiskCategory.NotSupported The specified disk category is not supported. 指定的雲端硬碟類型不支援當前操作。
403 InvalidRegion.NotSupport The specified region does not support resize online. 該地區不支援線上擴容。
403 InvalidInstanceStatus.NotRunning The status of instance to which the disk attachs must be running when resizing online. 線上調整磁碟大小時,磁碟串連到的執行個體的狀態必須正在運行。
403 InvalidOperation.InstanceTypeNotSupportOnlineResize The instance type of the specified instance does not support resize online.
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK needs to be added ECS tag. CMK 未授權
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS. ECS 服務無權訪問您的 KMS。
403 InstanceSpecModification.NotEffective The instance which the disk attachs has been reserved for making a spec modification and not taken effective in the current contract period.
403 InvalidDiskSize.NotSupportResizeOnline The current size of the resource does not support resize online.
403 SecurityRisk.3DVerification We have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email. 我們檢測到您的預設信用卡或借記卡存在安全風險。請通過電子郵件中的連結進行驗證。
403 QuotaExceeded.PostpaidDataDiskCapacity The quota of postpaid data disk capacity exceeds. 隨用隨付資料盤使用容量超出配額。
403 InvalidOperation.MultiAttachDiskNotSupportResizeOnline Multi attach disk does not support resize online. 開啟多重掛載特性的雲端硬碟不支援線上擴容。
403 InvalidDataDiskCategory.ValueNotSupported The specified Category of Data Disk is not valid. 指定的資料盤磁碟類型不支援
403 InvalidDiskSize.NotSupportMultiAttachDisk The specified disk size exceeds the maximum limit 65536 for enabling multi-attach. 大於 64 TB 的磁碟不支援開啟多重掛載
404 InvalidDiskId.NotFound The specified disk does not exist. 指定的磁碟不存在。請您檢查磁碟 ID 是否正確。
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定的執行個體ID無效。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情