全部產品
Search
文件中心

Elastic Compute Service:ReInitDisk

更新時間:Oct 09, 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。磁碟掛載的執行個體必須至少完成過一次啟動,且目前處於已停止(Stopped)狀態。

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"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 LoginAsNonRoot.ImageNotSupport The specified image does not support login as non-root. 此映像不支援 NonRoot 登入。
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. 指定的 Password 參數不合法。
400 InvalidKeyPairName.NotFound The specified KeyPairName does not exist. 指定的 KeyPairName 不存在。
400 DependencyViolation.IoOptimize The specified parameter InstanceId is not valid. 指定的執行個體 ID 不合法,指定的執行個體 IO 最佳化設定不合法。
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 an internal error and you may retry later or contact support with the request ID.
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 was created from a snapshot taken before 2013-07-15 and can no longer be reinitialized.
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 runs Windows and does not support SSH key pair login.
403 InvalidDisk.DiskFromClonedNotSupport The specified disk %s was cloned from source disk %s. Reinitialization is not supported for cloned disks.
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 does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service.
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 has not authorized the ECS service to perform the KMS TagResource and UntagResource operations. Please verify the authorization and try again.
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. 指定的磁碟不存在。請您檢查磁碟 ID 是否正確。
404 InvalidImageId.NotFound The specified ImageId does not exist. 指定的映像在該使用者帳號下不存在,請您檢查映像 ID 是否正確。
404 InvalidDiskId.OperationNotSupported The operation is not supported due to image not exist. 指定的映像不存在。

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

變更歷史

更多資訊,參考變更詳情。