Welcome: Hunan Intelligent Applications Tecgnology CO.,ltd.-HNIAT.com
Language: Chinese ∷  English

Basic knowledge

Alibaba Cloud International Station: Alibaba Cloud Linux system disk expansion operation example

Alibaba Cloud servers operate disk resizing in the background, but the system still cannot see the resized disks. That's because after Alibaba Cloud resizing, we still need to enter the Linux system for file system resizing. The specific operation methods are as follows according to Alibaba Cloud documents. If you still don't understand how to operate after reading, you can contact me to help expand the capacity. The charge is not high.
When the cloud disk (system disk or data disk) is out of space, you can expand the storage capacity of the cloud disk. This article describes how to expand the cloud disk for the Linux system without stopping the instance running.
prerequisite
Before Linux instances can use online resizing cloud disks, the following conditions need to be met.
The requirements of the example are as follows
The instance is an I/O optimization instance.
The public image used by the instance needs to support online capacity expansion.
The following instance types are not supported: ecs.ebmc4.8xlarge, ecs.ebmhfg5.2xlarge, ecs.ebmg5.24xlarge.
The instance status is Running.
The Linux kernel of the instance is no less than version 3.6.0. You can use the uname - a command to view the kernel version.
The requirements for cloud disk are as follows
The cloud disk status is In Use.
The cloud disk type is ESSD cloud disk, SSD cloud disk or efficient cloud disk.
After the renewal and configuration reduction of the monthly package ECS instance, the remaining time of the current billing cycle does not support the monthly package cloud disk of the expanded instance.
The capacity of cloud disk after expansion cannot exceed the maximum capacity of cloud disk
The specific steps are as follows
Step 1: Create a snapshot
Before expanding the cloud disk, create a snapshot for the cloud disk and make a data backup.
Log in to the Alibaba Cloud ECS console.
On the left navigation bar, select Instance and Mirror>Instance.
In the upper left corner of the top menu bar, select Region.
Find the instance that needs to expand the cloud disk, and click the instance ID.
On the instance details tab, click the cloud disk tab.
Find the cloud disk to be expanded, and click Create Snapshot in the operation column.
In the pop-up dialog box, enter the snapshot name, bind the label as required, and click Create.
Click the Snapshot tab to view the created snapshots.
When the progress of the snapshot is 100%, the snapshot creation is completed, and you can perform subsequent operations.
Step 2: Expand the cloud disk capacity on the console
On the instance details tab, click the cloud disk tab.
Select the cloud disk to be expanded, and click More>Cloud Disk Expansion in the operation column.
If you need to bulk expand multiple cloud disks, use your Alibaba Cloud account to select multiple cloud disks on the Storage and Snapshot>Cloud Disk page, and then click Cloud Disk Expansion at the bottom. The cloud disks attached to the same ECS instance do not support batch expansion.
On the disk expansion page, select online expansion and set the capacity after expansion.
The set capacity after capacity expansion cannot be less than the current capacity.
Confirm the fee, read and select the ECS Terms of Service, and click Confirm Capacity Expansion.
After reading the disk expansion instructions, click Read to continue the expansion and complete the payment.
The following are the key points
Step 3: View the cloud disk partition
Enter the ECS instance and view the partition type (MBR and GPT) and file system type (ext4, xfs, etc.) of the system disk and data disk. Different partitions and file systems have differences in subsequent partition expansion and file system operations.
Log in to the ECS instance remotely.
Run the following command to view the cloud disk of the instance
fdisk -lu
Take the three partitions of the system disk (/dev/vda1) and data disk (/dev/vdb1,/dev/vdc1) as an example. The execution results are shown below.
S/N Partition Description
① /dev/vda1 system disk. The System value Linux represents the MBR partition.
② /dev/vdb1 data disk. The system value Linux represents the MBR partition.
③ /dev/vdc1 data disk. The system value GPT represents the GPT partition.
Run the following command to confirm the file system type of the existing partition.
df -Th
The execution results are shown below.
Step 4: Expand the partition
By viewing the cloud disk partitions, the partitions and file systems in the ECS instance have not been expanded. This step describes how to expand cloud disk partitions within ECS instances.
1. Install the gdisk tool inside the ECS instance.
If your partition is in GPT format, you must perform this step; If your partition is in MBR format, skip this step.
yum install gdisk -y
2. Install the growpart tool.
CentOS 7 and above run the following commands.
yum install -y cloud-utils-growpart
Debian 9 and above, and Ubuntu 14 and above run the following commands.
Update the software source.
apt-get update
Install cloud guest utils.
apt-get install -y cloud-guest-utils
3. Run the following command to expand the partition.
growpart /dev/vda 1
This example takes the system disk expansion as an example. A space is required between/dev/vda and 1. If you need to expand other partitions, modify the command according to the actual situation. The execution results are shown below.
Step 5: Expand the file system
This step describes how to expand a partitioned file system within an ECS instance.
Within the ECS instance, expand the file system according to the type of file system queried.
Expand the ext * file system (for example, ext4): Run the following command to expand the file system.
The file system of system disk/dev/vda1 is expanded.
resize2fs /dev/vda1
The file system of data disk/dev/vdb1 is expanded.
resize2fs /dev/vdb1
Note:/dev/vda1 and/dev/vdb1 are partition names. You need to modify them according to the actual situation
Expand the xfs file system: Run the following command to expand the file system.
xfs_ growfs /media/vdc
Note:/media/vdc is the mount point of/dev/vdc1. You need to modify it according to the actual situation.
Run the following command to check the results after capacity expansion.
df -Th
The execution results are shown below.
After capacity expansion, you need to check whether the data is normal according to the actual situation.
If the capacity expansion is successful and the business programs in the ECS instance can run normally, the operation is completed.
If the expansion fails, the data will be rolled back through the backup snapshot.
If you are still not good at it, or you are worried that the system will crash due to an operation error, please contact me for assistance.
————————————————
Copyright statement: This is an original article of the CSDN blogger "Jusoyun Shanghai Jusuo Information Technology Co., Ltd.", which follows the CC 4.0 BY-SA copyright agreement. Please attach a link to the original source and this statement for reproduction.
Original link: https://blog.csdn.net/weixin_51708323/article/details/126925341

CONTACT US

Contact: Manager Xu

Phone: 13907330718

Tel: 0731-22222718

Email: hniatcom@163.com

Add: Room 603, 6th Floor, Shifting Room, No. 2, Orbit Zhigu, No. 79 Liancheng Road, Shifeng District, Zhuzhou City, Hunan Province

Scan the qr codeClose
the qr code