You cannot shrink system or data disks in Elastic Compute Service (ECS). You can use Alibaba Cloud Server Migration Center (SMC) to shrink disks.

Prerequisites

The preparations for the migration are complete. For more information, see Before you begin.

Background information

SMC is aimed to balance the cloud-based and offline workloads of Alibaba Cloud users. You can also use SMC to shrink ECS disks.

SMC allows you to create a custom image from an ECS instance or migrate the data of an instance to another instance. When you import the migrated data, you can re-specify the size of a disk to shrink the disk. Before you migrate the data of an instance, take note of the following items:
  • If you want to shrink a disk by migrating the data of the instance to which the disk is attached, make sure that the source instance and the destination instance are not the same one. The destination instance must be available and does not contain data or has all data backed up to an image, a snapshot, or a different device.
    Warning After the migration task is created, all original data in the destination instance is deleted. If the destination ECS instance contains important data, we recommend that you do not migrate the data of the source instance to the destination instance. In this case, we recommend that you set Resource Type to ECS Image and then create an ECS instance by using a custom image.
  • Some properties of the ECS instance are changed because the ECS instance is replaced when SMC is used to shrink the disk. For example, the ID (InstanceId) and public IP address of the instance are changed.

    If your source instance resides in a virtual private cloud (VPC), you can convert the public IP address of the instance into an elastic IP address (EIP). This way, you can retain the public IP address. If you have already used EIPs or have less dependence on public IP addresses, we recommend that you use SMC to shrink disks.

Procedure

  1. Import the data of the source instance.
    You must download the SMC client to the ECS instance whose disks you want to shrink and then use the client to import the source ECS instance to SMC. For more information, see Step 1: Import the information of a migration source.
  2. Create and start a migration task.
    For information about how to shrink disks by migrating the data of the source instance to the destination instance, see Migrate servers to ECS instances. When you create a migration task, take note of the following items:
    • Configure the System Disk and Data Disk parameters in the Target Disk Size section based on your requirements. The values of these parameters cannot be less than the amounts of used space of the system and data disk.
    • If you want to create a custom image from the source instance and then create an ECS instance from the custom image, set Resource Type to ECS Image when you create a migration task.
  3. Wait until the migration task is completed.
    • If the migration task is in the Completed state, the task is completed and you can view the destination ECS instance.
      • If you set Target Image Type to ECS Instance, you can click View Target Instance in the Actions column to go to the Target Instance page.
      • If you set Target Image Type to ECS Image, you can perform the following steps to create an ECS instance by using an image:
        1. Verify the migration result. This feature verifies whether the image generated by the migration task can create and start instances. This verification is based on the Operation Orchestration Service (OOS) template named ACS-SMC-CreateAndVerifyInstance provided by Alibaba Cloud.
          1. Click Verify Migration Result in the Actions column.
          2. In the dialog box that appears, read the verification process, and click Verify Now.

            You can also click Custom Verification Script to set the parameters.

          3. View the verification result in the Last Migration Result column.
            • Successful: indicates that the migration is successful. You can click View Output Parameter to check the details.
            • Failed: indicates that the migration failed. You can click View Cause to view the cause of failure and troubleshoot errors.
            • You can also click the ... icon in the Actions column, and then click Check Verification History in the OOS Console to view the template history.
        2. Click Create Instance in the Actions column.list
        3. Set the parameters to create the destination instance. For more information, see Create an ECS instance by using a custom image.
        4. Connect to the destination instance and check its system. For more information, see the "How do I check my system after I migrate a Windows server?" or "How do I check my system after I migrate a Linux server?" section of the SMC FAQ.
    • If the migration task is in the InError state, the task failed. You can check the logs to troubleshoot the failure. Then, restart the migration task. For information about common errors and solutions, see SMC FAQ.