All Products
Search
Document Center

Elastic Compute Service:Detach or attach a system disk

Last Updated:May 15, 2026

Detach a system disk to migrate data or repair corrupted files, then reattach it to the source instance.

Considerations

After the system disk is detached, the instance and disk do not support the following operations:

  • Start the instance.

  • Change the billing method of the instance.

  • Change the instance type.

  • Change the public bandwidth.

  • Create a custom image.

  • Separately release the system disk.

  • Replace the system disk.

  • Resize the system disk.

  • Change the billing method of the disk.

Detach a system disk

Prerequisites

Before you detach the system disk, make sure the following requirements are met:

  • Snapshots are created for the system disk to back up data. See Manually create a single snapshot.

  • The instance is in the Stopped state. The system disk can only be detached offline.

  • If the instance was created from a custom image, the custom image is not deleted.

  • The instance image is not an Alibaba Cloud Marketplace image or a custom image created from one.

Procedure

  1. Go to ECS console - Instances.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. Find an instance that is in the Stopped state and click the ID of the instance.

  4. Click the Block Storage tab.

  5. In the Actions column of the System Disk, choose 更多 > Detach.

  6. In the Detach Disk message, click OK.

    Note
    • By default, Release Disk with Instance is enabled for the system disk. The system disk belongs to the source instance. If this option remains enabled, the system disk is released when the source instance is released, regardless of whether the disk is detached or attached to another instance as a data disk.

    • If you clear Release Disk with Instance, the system disk is retained as a pay-as-you-go data disk when the source instance is released.

  7. Verify that the system disk is detached.

    1. Return to the Instance page. The No System Disk state is displayed in the Status column, and the acs:ecs:sourceSystemDiskId tag is added to the instance.

    2. In the left-side navigation pane, choose Storage & Snapshots > Cloud Disk.

    3. The system disk is now a data disk. The Status column displays Detached System Disk. The disk has the acs:ecs:sourceInstanceId, acs:ecs:diskDeleteProtection, and acs:ecs:diskPayType tags. The billing method remains unchanged.

    The instance and disk tags help you find resources. The following table describes the tag formats.

    Tag key

    Description

    Tag value

    acs:ecs:sourceSystemDiskId

    The system disk ID of the instance.

    The ID of the disk.

    acs:ecs:sourceInstanceId

    The ID of the instance to which the system disk was attached.

    The instance ID.

    acs:ecs:diskDeleteProtection

    Release protection is enabled. The disk cannot be manually released.

    true

    acs:ecs:diskPayType

    The billing method of the disk.

    The billing method of the disk before detachment. Valid values:

    • Prepaid: subscription

    • AfterPay: pay-as-you-go

Attach the system disk to another instance as a data disk

After the system disk is detached, attach it as a data disk to another ECS instance in the same zone for data migration or file repair. See Attach a data disk.

Reattach the repaired disk as the system disk

After repairing the disk on another instance, attach it back to the source instance as the system disk.

Prerequisites

Before you reattach the system disk, make sure the following requirements are met:

  • The instance is in the No System Disk state.

  • The instance is the original instance from which the system disk was detached.

Procedure

  1. Go to ECS console - Instances.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. Detach the repaired disk from the repair instance.

    See Detach data disk.

  4. Find the source instance that is in the No System Disk state. In the Actions column, click Attach Disk.

  5. In the Attach Disk dialog box, perform the following operations:

    1. Copy the ID of the Source System Disk and paste it in the Disk field.

    2. Configure the following parameters.

      Parameter

      Description

      Example

      Logon Username

      The logon username.

      Warning

      Logging on as root grants full permissions but poses security risks. We recommend using ecs-user instead.

      ecs-user

      Logon Credential

      The logon credentials.

      • Key Pair: Linux instances only.

      • Password: Available for both Windows Server and Linux instances. For Windows Server, only the administrator username is supported. For Linux, only root or ecs-user is supported.

      Key Pair

      Release Mode

      Release Disk with Instance: specifies whether to release the disk when the instance is released.

      • Selected: the disk is released with the instance.

      • Not selected: the disk is retained as a pay-as-you-go data disk.

      Do not select this option

      Delete Automatic Snapshots While Releasing Disk: specifies whether to delete automatic snapshots when the disk is released.

      • Selected: automatic snapshots are deleted with the disk.

      • Not selected: automatic snapshots are retained.

      Select this option

    3. Click Next.