After a disk (system disk or data disk) is created for an ECS instance, you cannot directly shrink its capacity. To shrink a disk, use Server Migration Center (SMC) to migrate the data or create a new, smaller disk.
-
When you shrink a disk, consider factors such as data security, business continuity, and cost. This topic provides general methods and steps to help you plan the process. Choose a method based on your business requirements.
-
Shrinking a disk involves downtime for data migration and configuration changes, causing temporary service interruptions. To minimize the impact on your business, we recommend that you perform these operations during off-peak hours.
Prerequisites
Before you start the migration, create a snapshot of the disk to back up your data. For more information, see Create a snapshot.
Snapshots incur fees. For more information, see Snapshot billing.
Use SMC to shrink a disk
Although Server Migration Center (SMC) is designed to migrate workloads to Alibaba Cloud, you can also use it to shrink an ECS disk. When you migrate an ECS instance across the same or different accounts, SMC can migrate your instance to a new custom image or a destination instance with a smaller disk. For more information, see Migrate data between ECS instances in the same or different accounts.
This method applies to both system disks and data disks.
Usage notes
-
During the migration, SMC creates a pay-as-you-go intermediate instance for the migration, which incurs fees.
NoteIf the migration is successful, the intermediate instance is automatically released. If the migration fails, the instance remains associated with the migration task and continues to incur fees. To avoid unnecessary charges, manually release the intermediate instance. For more information, see Clear resources.
-
After the migration, the ID and IP address of the ECS instance change. If your application configuration relies on the IP address, update the configuration after the migration. For more information about the impacts of migration, see Migration impacts.
Procedure
Linux systems
-
Complete the migration preparations. For more information, see Migration prerequisites.
-
Import the source Linux instance into SMC.
Set Migration Source Type to ECS Instance. For more information, see Step 1: Import a migration source.
-
Create and start a migration task.
When you create the migration task, note the following parameters:
-
Destination Type: Select ECS Image.
-
In the Modify Disk Partition section, adjust the destination disk size. By default, the partition structure of the destination disk is the same as the source disk. You can adjust the Destination Disk size based on your requirements.

-
Disable Block Replication.
For Linux systems, you can modify partition sizes only after you disable block replication.
-
Modify the disk size and partition sizes. The disk size cannot be smaller than the used space on the source disk, and the total disk capacity must be greater than the sum of all partition sizes.
For example, if the source disk is 50 GiB and you want to shrink it to 40 GiB, you must also modify the partition sizes accordingly.
-
-
For more information about other parameters, see Step 2: Configure a migration job.
-
-
After a successful migration, SMC generates a custom image. In the Actions column for the migration task, click Create Instance. You are redirected to the ECS console to create an ECS instance.
-
The custom image is selected by default.
-
The default system disk type and capacity may not match your target configuration. Adjust them as needed.
-
For information about how to configure other parameters, see Create an instance by using a custom image or shared image.
-
Windows systems
-
Use the Shrink Volume feature in Windows to shrink the source disk partition to your target capacity.
In SMC, block replication is enabled by default for Windows systems and cannot be disabled. This prevents you from modifying partition sizes or the disk size during migration. Therefore, you must first shrink a volume on the source disk before you start the migration. For more information, see Steps 1 to 5 in Repartition a Windows disk by shrinking a volume.
For example, if the source disk (C:) has a single 40 GB partition, you can shrink it. The result is an allocated partition of 20.47 GB and unallocated space of 19.53 GB.

-
Make sure that you have completed the preparations for migration. For more information, see Migration prerequisites.
-
Import the Windows instance that you want to shrink into SMC as a migration source.
Set Migration Source Type to Alibaba Cloud ECS instance. For more information, see Step 1: Import a migration source.
-
Create and start a migration task.
When you create the migration task, note the following parameters:
-
Destination Type: Select ECS Image.
-
In the Modify Disk Partition section, adjust the destination disk size. The partition structure of the destination disk is the same as the source disk by default. You can adjust the Destination Disk size based on your requirements.
NoteAfter shrinking the volume on the source disk, you can adjust the target disk capacity. Remember that the total disk capacity must be greater than the sum of all partition sizes.
For example, if the source disk is 40 GiB, you can set the destination disk size to 30 GiB.

-
For more information about other parameters, see Step 2: Configure a migration job.
-
-
After the migration is successful, a custom image is generated. In the Actions column for the migration task, click Create Instance. You are redirected to the ECS console to create an ECS instance.
-
The custom image is selected by default.
-
The default system disk type and capacity may not match your target configuration. Adjust them as needed.
-
For information about how to configure other parameters, see Create an instance by using a custom image or shared image.
-
Shrink a disk by creating a new one
This method applies only to data disks.
-
System disks: System disks are created with their instances and cannot be managed independently. Therefore, you cannot use this method to shrink a system disk.
-
Data disks: You can shrink a data disk by creating a new data disk with your target capacity, attaching it to the original ECS instance, and copying the data from the old disk to the new one.
ImportantIf the data disk has dependencies on the system disk, shrinking the disk or changing configuration files may interrupt your services. To minimize the impact on your business, we recommend that you perform these operations during off-peak hours.
The general steps are as follows:
-
Create an empty data disk and set its capacity to your target size.
For more information, see Create an empty data disk.
-
Attach the new data disk to the original ECS instance and initialize it.
For more information, see Attach a data disk.
-
Copy the data from the original data disk to the new one.
After copying the data, verify its integrity on the new disk.
-
If your applications reference a specific drive letter or path, update their configuration files after replacing the data disk.
-
To avoid unnecessary charges, detach and release the original data disk.
For more information, see Detach a data disk and Release a disk.
-