In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The content of this article mainly focuses on how to expand the system disk and data disk of the Linux server without downtime. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!
When the CVM cloud disk (system disk or data disk) runs out of space, you can expand the storage capacity of the cloud disk. This document describes how to expand the cloud disk for the Linux system without stopping the instance.
Note: before expanding the capacity of the cloud disk, be sure to create a snapshot of the cloud disk and make a good data backup.
Step 1: expand the capacity of cloud disk in the console
On the left navigation bar of the instance details page, click the cloud disk of this instance.
Select the cloud disk that needs to be expanded, and click more > Cloud disk expansion in the Operation column.
If you need to expand the capacity of multiple cloud disks in batches, use the AliCloud main account to select multiple cloud disks on the Storage and Snapshot > Cloud disk page, and then click the cloud disk at the bottom to expand capacity. Batch expansion is not supported for cloud disks mounted under the same ECS instance.
On the disk expansion page, select online capacity expansion, and set the capacity after expansion. The expanded capacity is not allowed to be less than the current capacity.
Confirm the fee. After reading and selecting "CVM ECS terms of Service", click to confirm the expansion.
After reading the instructions for disk expansion, click read to continue the expansion and complete the payment.
Note: after you expand the capacity of the cloud disk on the console, you cannot directly use the expanded capacity. You need to expand the partition and file system within the Linux system.
Step 2: check the partition of the cloud disk
Enter the Linux system and view the partition type (MBR and GPT) and file system type (ext4, xfs, etc.) of the system disk and data disk. There are differences in subsequent expansion of partitions and file system operations for different partitions and file systems.
Remotely log in to the ECS server.
Run the command fdisk-lu to view the cloud disk of the instance.
The example takes the three partitions of the system disk (/ dev/vda1) and the data disk (/ dev/vdb1, / vde/vdc1) as examples, as shown in the following figure.
The serial number partition indicates the ① / dev/vda1 system disk, and the value Linux of System is expressed as the MBR partition. ② / dev/vdb1 data disk. The value of System is expressed as MBR partition by Linux. ③ / dev/vdc1 data disk. The value of System is expressed as GPT partition by GPT.
Run the command df-Th to confirm the file system type of the existing partition.
Step 3: expand the partition
By checking the partition of the cloud disk, the partition and file system in the Linux have not been expanded. This step describes how to expand the cloud disk partition within the ECS instance.
Install the gdisk tool in Linux.
You must perform this step if your partition is in GPT format, or skip this step if your partition is in MBR format.
Yum install gdisk-y
Run the command growpart / dev/vda 1 to expand the partition. This example takes the expanded system disk as an example. Space separation is required between / dev/vda and 1. If you need to expand the capacity of other partitions, modify the command according to the actual situation.
Step 4: expand the file system
This step describes how to expand the file system of a partition in Linux.
In Linux content, expand the file system according to the type of file system queried.
Expand ext* (such as ext4) file system: run the command resize2fs / dev/vda1 to expand the file system.
# expand the file system of system disk / dev/vda1 resize2fs / dev/vda1 # expand the file system of data disk / dev/vdb1 resize2fs / dev/vdb1
Note that / dev/vda1 and / dev/vdb1 are partition names, which you need to modify according to the actual situation.
Expand the xfs file system: run the command xfs_growfs / media/vdc to expand the file system. Note that / media/vdc is the mount point of / dev/vdc1, which you need to modify according to the actual situation.
Run the command df-Th to check the result of the expansion.
After the expansion is completed, you need to check whether the data is normal according to the actual situation.
If the expansion is successful and the business programs in the ECS instance can run normally, the operation will be completed.
If the expansion fails, the data is rolled back through the backed-up snapshot.
An operating system that supports non-downtime expansion
Linux public images (or custom images based on public images) that support non-stop expansion include:
Aliyun Linux:Aliyun Linux 2.1903 LTS 64-bit
CentOS:CentOS 6.8 +, CentOS 7.2 +, CentOS 8 and above
Red Hat Enterprise Linux:RHEL 6.9 +, RHEL 7.4 +, RHEL 8 and above
Ubuntu:Ubuntu 16 and above
Debian:Debian 8 and above
SUSE:SUSE 12 SP2 and above
OpenSUSE:OpenSUSE42.3 and above
common problem
Problem: running growpart / dev/vda 1 prompts unexpected output in sfdisk-- version [sfdisk, from util-linux 2.23.2].
Solution:
Run LANG=en_US.UTF-8 to switch the character encoding type of the ECS instance.
If the problem remains unresolved, try running the reboot command to restart the ECS instance.
If the problem remains unresolved, try running the localectl set-locale.UTF-8 command to modify the localized environment variable, and then restart the instance.
Problem: run growpart / dev/vda 1 and prompt-bash: growpart: command not found.
Solution:
CentOS 7 and above: run the command yum install-y cloud-utils-growpart.
Debian 9 and above, Ubuntu14 and above: run the command apt install-y cloud-guest-utils.
Run uname-a to check that the Linux kernel is no less than version 3.6.0.
If the Linux kernel is less than version 3.6.0, contact the cloud technology online engineer to expand the partition.
Install growpart tools according to different versions of Linux.
Other expansion scenarios
If the data disk needs to create a new partition with the new capacity expansion, you need to add and format the MBR partition or add and format the GPT partition.
If the data disk does not create a partition and a file system is created on the bare device, you need to expand the bare device file system.
Thank you for your reading. I believe you have a certain understanding of "how to expand the system disk and data disk of the Linux server without downtime". Go to practice quickly, if you want to know more related knowledge points, you can follow the website! The editor will continue to bring you better articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.