You can detach a data disk from an ECS instance if the billing method of the data disk is pay-as-you-go. You cannot detach a data disk which is used as a local disk.

Prerequisites

Ensure that you have performed the following operations before detaching a disk:
  • The cloud disk has been attached to an instance and its Status is In Use.
  • To ensure data integrity, we recommend that you stop reading or writing file systems of the data disk to avoid data loss before you detach the data disk.
  • If file systems have been attached to the data disk, you must connect to the ECS instance and detach the data disk or partitions from the operating system, as shown in the following table.
    Operating system Detach a data disk or partition
    Linux Run the umount [Data disk partition] command such as umount /dev/vdb1.

    If you have written the partition attachment information to the /etc/fstab file, delete the partition attachment information. Otherwise, you cannot connect to the instance after the instance is restarted.

    Windows Server In the Disk Management dialog box, right-click the disk name such as Disk 2 and select Offline.

Background information

You can detach a data disk in the ECS console in the following ways:

Detach a cloud disk on the Instance Details page.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Storage & Snapshots > Disks.
  3. In the top navigation bar, select a region.
  4. Find the target instance and click its ID to go to the Instance Details page.
  5. In the left-side navigation pane, click Disks.
  6. Find the target disk and choose More > Release in the Actions column.
    Only data disks that have the following attributes can be detached:
    • Status must be In Use.
    • Detachable must be Yes.
    • Disk Category must be Data Disk.
  7. In the message that appears, click OK.
Note You can repeat the preceding procedure to detach multiple data disks.

When the Status becomes Unattached, it indicates that the data disk has been detached.

Detach a data disk on the Disks page

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Storage & Snapshots > Disks.
  3. In the top navigation bar, select a region.
  4. Find the target disk and choose More > Release in the Actions column.
    Only data disks that have the following attributes can be detached:
    • Status must be In Use.
    • Detachable must be Yes.
    • Disk Category must be Data Disk.
  5. In the message that appears, click OK.

When the Status becomes Unattached, it indicates that the data disk has been detached.

What to do next

You can release cloud disks that are no longer needed. For more information, see Release a disk.