Home > Article > Operation and Maintenance > How to use Alibaba Cloud migration tool to reduce disk size
The content of this article is about how to use Alibaba Cloud Migration Tool to reduce disk size. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Disk reduction
Since the current cloud server ECS does not support system disk or data disk reduction, if you have the need to reduce disk size, you can use the Alibaba Cloud Migration Tool to achieve the goal.
Implementation Principle
The original intention of developing the cloud migration tool is to balance the cloud and offline business loads of Alibaba Cloud users, but you can Using its working principle, the cloud server ECS disk can be reduced in a detour.
The cloud migration tool can re-create a custom image based on your ECS instance. During the creation process, the disk size can be re-specified to achieve the purpose of shrinking the image. Except for changing the target object to an ECS instance, the usage methods and usage restrictions of the tools in the two scenarios of disk shrinking and cloud migration are exactly the same. Even because the object is a virtualized ECS instance, it will be more convenient and the chance of error reporting will be lower.
However, this scaling method will cause some attributes of the original ECS instance to change, such as the instance ID (InstanceId) and public IP. If your instance is a private network (VPC) instance, you can convert the public IP to an elastic public IP to retain the public IP. Therefore, it is recommended to use elastic public IP (EIP) or users who are less dependent on public IP to use this method to reduce capacity.
Prerequisites
When the disk is mounted to a Linux instance, you need to install the remote data synchronization tool rsync in the instance in advance.
CentOS instance: run yum install rsync –y
Ubuntu instance: run apt-get install rsync –y
Debian instance: run apt-get install rsync –y
Other distributions: Refer to the installation related documentation on the distribution official website
You need to create an Access Key in the console in advance for output to the configuration file user_config.json.
Note: Due to the excessive permissions of AccessKey, in order to prevent data leakage, it is recommended that you create a RAM user sub-account and use the RAM user sub-account to create AccessKey.
For more prerequisites and restrictions, please refer to Using the Cloud Migration Tool to Migrate Servers to Alibaba Cloud.
Operation steps
Use the administrator/root account to remotely connect to the target ECS instance.
Download the Alibaba Cloud Migration Tool ZIP package.
Unzip the cloud migration tool and enter the client file directory corresponding to the operating system and version to find the configuration file user_config.json.
Refer to the paragraph Customize user_config.json to complete the configuration.
The Linux Shell display effect of this configuration file is as shown in the figure below.
In the disk shrink scenario, the parameters you need to focus on are:
system_disk_size: This parameter can be set to the expected size of the system disk. Value, in GB. This value cannot be less than the actual space used by the system disk.
data_disks: This parameter can be set to the expected value of the reduced data disk, in GB. This value cannot be less than the actual space used by the data disk.
Note:
When the Linux instance comes with its own data disk, even if you do not consider shrinking the data disk, you still need to configure the parameter data_disks, otherwise the cloud migration tool will copy the data of the data disk to system disk.
When the Windows instance comes with its own data disk, if there is no need to shrink the data disk, you do not need to configure the parameter data_disks.
Execute the client main program go2aliyun_client.exe:
Windows instance: Right-click go2aliyun_client.exe and select Run as administrator.
Linux example:
Run chmod x go2aliyun_client to give the client executable permissions.
Run ./go2aliyun_client to run the client.
Waiting for the running results:
When the Goto Aliyun Finished! prompt appears, go to the ECS console image details page to view the reduced custom image. If the custom image has been generated, you can release the original instance and then use the generated custom image to create an ECS instance. After the creation is completed, the disk shrinking work is completed.
When the Goto Aliyun Not Finished! prompt appears, check the log files in the Logs folder in the same directory to troubleshoot. After fixing the problem, run the cloud migration tool again to resume the scale reduction work. The cloud migration tool will continue the cloud migration from the last execution progress without starting over.
The above is the detailed content of How to use Alibaba Cloud migration tool to reduce disk size. For more information, please follow other related articles on the PHP Chinese website!