Process Expanded EBS Disk Capacity in Linux

This chapter mainly describes how to expand partition capacity after an EBS disk of Linux OS has been expanded.

About this task

The Linux OS is CentOS7.2_64 bit, and a data disk has been mounted to it.

Before expansion, the data disk has only one primary partition (/dev/vdb1), and the file system is ext3. The mount point is /mnt, and the size is 20 G. After expansion, the size of the data disk is 30 G, but it still has only one primary partition.

Procedure

  1. Connect to the ECS instance remotely.
  2. View the current mounting information of the disk.
    df -TH

    In the output, we can see that the current capacity of /dev/vdb1 is 20 G, the type of the file system is ext3, and the mount path is /mnt.

  3. Unmount the disk partition.
    umount /dev /vdb1
  4. Create a new partition.
    fdisk /dev/vdb
    1. Enter d to delete the original partition /dev/vdb1.
      Important: Deleting the partition may result in data loss on this disk. If the disk has multiple partitions, we recommend that you not delete it.
    2. Type in n and press Enter to create a new partition.

      In the information displayed, p represents a primary partition, and e represents an extended partition. In this example, a primary partition will be created.

    3. Type in p and press Enter to create a primary partition.

      In the information displayed, Partition number represents the serial number of the primary partition. The value range is from 1 to 4. The default value is 1.

    4. Type in the number and press Enter. Or press Enter directly and the system will use the default value 1.

      In the information displayed, First sector represents the serial number of the first sector. The value range is from 2048 to 20971519, and the default value is 2048.

    5. Type in the number and press Enter. Or press Enter directly and the system will use the default value 2048.

      In the information displayed, Last sector represents the serial number of the last sector. The value range is from 2048 to 62914559, and the default value is 62914559.

    6. Type in the number and press Enter. Or press Enter directly and the system will use the default value 62914559.

      A primary partition has been created for a data disk of 30 GB.

    7. Type in w and press Enter to write the result to the partition table.

      The above information indicates that the partition is successfully created.

      Note: In case that you make a mistake in the process, you can exit by entering q, and the partition created before will be discarded.
    8. Run the command fdisk -l to view the new partition.

  5. Check the file system.
    e2fsck -f /dev/vdb1
  6. Refresh the size of the file system.
    resize2fs /dev/vdb1
  7. Mount the new partition to the directory /mnt.
    mount /dev/vdb1 /mnt
  8. View the mounting result.
    df -TH

    In the information displayed, we can see that the size of the partition mounted currently is 30 G, and the mount directory is /mnt.

Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products