全部產品
Search
文件中心

Elastic Compute Service:ReInitDisk

更新時間:Jun 19, 2026

重新初始化一塊磁碟至建立時的初始狀態。

介面說明

呼叫該介面時,您需要注意:

  • 磁碟的狀態必須為使用中In_use),雲端硬碟掛載的 ECS 執行個體的狀態必須為已停止Stopped)。

  • 執行個體首次啟動前,不能重新初始化掛載在其上的磁碟。

  • 已存在本機快照的雲端硬碟,不能重新初始化。

  • 對於系統碟,初始化到映像的最初狀態。若建立雲端硬碟的來源映像被刪除,則無法初始化。

  • 對於直接建立的資料碟,初始化到空碟狀態;對於透過快照建立的資料碟,初始化到快照狀態。若來源快照已被刪除,則無法初始化並傳回錯誤。

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ReInitDisk

update

*Disk

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

  • ecs:PasswordCustomized

請求參數

名稱

類型

必填

描述

樣本值

DiskId

string

待初始化的磁碟 ID。

d-bp67acfmxazb4ph****

Password

string

重新初始化系統碟時,是否重設 ECS 執行個體的使用者名稱密碼。長度為 8 至 30 個字元,必須同時包含大小寫英文字母、數字和特殊符號中的三類字元。特殊符號可以是:

()`~!@#$%^&*-_+=|{}[]:;'<>,.?/

其中,Windows 執行個體不能以斜線號(/)為密碼首字元。

說明

如果傳入Password參數,建議您使用 HTTPS 協定傳送請求,避免密碼洩露。

EcsV587!

KeyPairName

string

金鑰對名稱。

說明

該參數僅適用於 Linux 執行個體。重新初始化系統碟時,您可以為 ECS 執行個體繫結一個 SSH 金鑰對,作為登入憑證。使用了 SSH 金鑰對後,使用者名稱密碼的登入憑證方式將被停用。

testKeyPairName

AutoStartInstance

boolean

重新初始化磁碟後,是否自動啟動執行個體。取值範圍:

  • true:是,自動啟動執行個體。

  • false:否。

預設值:false。

true

SecurityEnhancementStrategy

string

當指定的雲端硬碟為系統碟時,重新初始化雲端硬碟後是否免費使用雲端安全中心服務。取值範圍:

  • Active:使用。該值僅支援公共映像。

  • Deactive:不使用。該值支援所有映像。

預設值:Deactive。

Active

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

樣本

正常返回樣本

JSON格式

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

異常返回樣本

JSON格式

{
    "RequestId":"F3CD6886-D8D0-4FEE-B93E-1B73239673DE"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 LoginAsNonRoot.ImageNotSupport The specified image does not support login as non-root.
400 DiskHasSnapshotsWithInstantAccessEnabled.OperationNotSupported The operation is not supported to the specified disk that have snapshots with InstantAccess enabled.
400 InvalidPassword.Malformed The specified parameter "Password" is not valid.
400 InvalidKeyPairName.NotFound The specified KeyPairName does not exist.
400 DependencyViolation.IoOptimize The specified parameter InstanceId is not valid.
400 DiskCategory.OperationNotSupported The operation is not supported to the specified disk due to its disk category.
400 InvalidRegionId.MalFormed The specified RegionId is not valid.
500 InternalError The request processing has failed due to some unknown error, exception or failure.
403 LoginAsNonRoot.RegionNotSupport The specified region does not support login as non-root.
403 IncorrectDiskStatus The current disk status does not support this operation.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 InstanceLockedForSecurity The instance is locked due to security.
403 InvalidSnapshot.TooOld The disk is created from a snapshotId made before 2013-07-15, it cannot be re-initiated the specified disk any more since the detached first time.
403 OperationDenied The snapshot which is used to create the specified disk has been deleted.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet.
403 SharedImageDeleted The specified image by others shared is deleted.
403 DependencyViolation.WindowsInstance The instance creating is windows, cannot use ssh key pair to login.
403 InvalidDisk.DiskFromClonedNotSupport The specified disk %s is cloned from source disk %s, so not support reinit
403 UserNotInTheWhiteList The user is not in volume white list.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service have no right to access your KMS.
403 HibernationConfigured.InstanceOperationForbidden The operation is not permitted due to limit of the hibernation configured instance.
403 InvalidOperation.MultiAttachDisk Multi attach disk does not support this operation.
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK needs to be added ECS tag.
403 InvalidSourceSnapshot The source snapshot of the disk has been deleted and cannot support the current operation.
403 InvalidOperation.ReInitUnsupported The specified disk does not support reInit. 指定云盘不支持重新初始化。
404 InvalidDiskId.NotFound The specified disk does not exist.
404 InvalidImageId.NotFound The specified ImageId does not exist.
404 InvalidDiskId.OperationNotSupported The operation is not supported due to image not exist.

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

變更歷史

更多資訊,參考變更詳情