# 更換系統硬碟
描述
更換系統硬碟會改變這台雲端服務器的系統硬碟的磁碟 ID。更換系統硬碟時,不改變系統硬碟的磁碟種類和付費方式,同時原系統硬碟將被刪除;
更換系統硬碟時可以重新指定系統硬碟的容量大小(參數SystemDiskSize),SystemDisksSize必須大於等於max{40,更換前的系統硬碟容量};超過max{40,更換前的系統硬碟容量}的容量部分,將收取額外費用;
執行個體的狀態必須為 Stopped 狀態,且執行個體的 OperationLocks 中沒有標記 "LockReason" : "security" 的鎖定狀態,且不欠費;
請求參數
| 名稱 |
類型 |
是否必須 |
描述 |
| Action |
String |
是 |
系統規定參數,取值:ReplaceSystemDisk |
| InstanceId |
String |
是 |
指定執行個體的 ID |
| ImageId |
String |
是 |
重設系統時使用的鏡像 ID。 |
| SystemDisk.Size |
String |
否 |
新的系統硬碟容量,以GB為單位,取值範圍為:min ~ 500;
min=Max{40,ImageId.size};
預設值:min; |
| ClientToken |
String |
否 |
用於保證請求的等冪性。由用戶端產生該參數值,要保證在不同請求間唯一,最大不值過 64 個 ASCII 字元。
具體參見附錄:如何保證等冪性。 |
返回參數
| 名稱 |
類型 |
描述 |
| DiskId |
String |
新系統硬碟的磁碟 ID |
錯誤碼
| 錯誤碼 |
描述 |
Http 狀態代碼 |
語義 |
| MissingParameter |
The input parameter "InstanceId" that is mandatory for processing this request is not supplied. |
400 |
InstanceId 參數未指定 |
| MissingParameter |
The input parameter "ImageId" that is mandatory for processing this request is not supplied. |
400 |
ImageId 參數未指定 |
| QuotaExceed.BuyImage |
The specified image is from the image market,You have not bought it or your quota has been exceeded. |
403 |
指定的鏡像來自鏡像市場,您沒有購買或者該鏡像在次地區的配額已用完 |
| InvalidSystemDiskSize.LessThanImageSize |
The specified parameter“SystemDisk.Size”is less than the image size |
404 |
指定的 SystemDiskSize 小於鏡像的大小 |
| InvalidSystemDiskSize.MoreThanMaxSize |
The specified parameter "SystemDisk.Size" is more than the max size |
404 |
指定的 SystemDiskSize 大於最大容量上限 |
| InvalidSystemDiskSize.LessThanMinimumSize |
The specified parameter"SystemDisk.Size" is less than the minimum size |
404 |
指定的 SystemDiskSize 小於最小容量 |
| InvalidInstanceId.NotFound |
The specified instance does not exist. |
404 |
指定的執行個體不存在 |
| InvalidImageId.NotFound |
The specified Image is disabled or is deleted. |
404 |
指定的鏡像不存在 |
| IncorrectInstanceStatus |
The current status of the resource does not support this operation. |
403 |
指定的執行個體狀態不正確 |
| InstanceLockedForSecurity |
The instance is locked due to security. |
403 |
指定的執行個體被安全鎖定 |
| ImageNotSubscribed |
The specified image has not be subscribed. |
403 |
指定的鏡像未在鏡像市場訂閱 |
| ImageRemovedInMarket |
The specified market image is not available, Or the specified user defined image includes product code because it is based on an image subscribed from marketplace, and that image in marketplace includeing exact the same product code has been removed. |
403 |
指定的鏡像已經從鏡像市場中下架 |
| OperationDenied |
Internal Error. |
500 |
內部錯誤 |
| InvalidParameter.Conflict |
The specified image does not support the specified instance type. |
400 |
指定的鏡像不能在指定的執行個體規格上使用 |
| InvalidInstanceId.NotFound |
The InstanceId provided does not exist in our records. |
404 |
指定的執行個體不存在 |
| InstanceExpiredOrInArrears |
The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). |
403 |
指定的執行個體已欠費 |
| ChargeTypeViolation |
The operation is not permitted due to charge type of the instance. |
403 |
指定執行個體的付費方式不支援更換系統硬碟 |
| DiskCreatingSnapshot |
The operation is denied due to a snapshot of the specified disk is not completed yet. |
403 |
指定的磁碟正在建立快照 |
| IoOptimized.NotSupported |
The specified image is not support IoOptimized Instance. |
403 |
鏡像必須支援 IO 最佳化執行個體 |
| InvalidParameter.Conflict |
The specified image does not support the specified instance type. |
400 |
指定的鏡像不支援建立這一類規格的執行個體 |
樣本
請求樣本
https://ecs.aliyuncs.com/?Action=ReplaceSystemDisk
&InstanceId=i-23jggx34b
&ImageId=m-myimage11
&<公用請求參數>
返回樣本
XML格式
d-23jbf2v5m
F3CD6886-D8D0-4FEE-B93E-1B73239673DE
JSON格式
{
"DiskId": "d-23jbf2v5m",
"RequestId": "F3CD6886-D8D0-4FEE-B93E-1B73239673DE"
}