Solve the online expansion of Alibaba Cloud ECS disk does not take effect (CentOs example)

Problem Description

The disk capacity does not increase after the cloud disk is expanded online in ECS

problem causes

ECS console operation expansion only expands the storage capacity of the cloud disk, and does not expand the file system of the ECS instance

solution

  1. Precautions
    • If there are risky operations such as modifying or changing the instance or data, be sure to pay attention to the disaster recovery and fault tolerance capabilities of the instance to ensure data security
    • If you want to modify the configuration and data of instances (including but not limited to ECS, RDS), etc., it is recommended to create snapshots in advance or enable RDS log backup and other functions
  2. Steps
    • Query the mounted hard disk

      df -lh
      

      It shows only 40G, but my side has been expanded to 60G
      insert image description here

      fdisk -l
      

      Through the fdisk -l command, you can see that the capacity has been expanded, but the disk information has not been changed.
      insert image description here

    • Perform file system expansion

      #安装growpart
      yum -y install cloud-utils-growpart
      #自适应分区扩容
      growpart /dev/vda 1
      #重设分区大小
      resize2fs /dev/vda1
      
    • Use the df -h command to verify

      df -lh
      

      insert image description here

Guess you like

Origin blog.csdn.net/qq_41322460/article/details/130423766