# 更换系统盘
描述
更换系统盘会改变这台云服务器的系统盘的磁盘 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"
}
所属专题: