All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Resize the file system of a raw disk

Last updated:2021-07-01 14:34:04

Scenarios

After you expand the capacity of an EBS volume that has no partitions but a file system, you can directly resize the file system.

Prerequisites

  1. You have created a snapshot to back up the data on the EBS volume. To prevent data loss caused by misoperations, we recommend that you create a snapshot to back up data before you expand the capacity of an EBS volume.
  2. You have expanded the capacity of the EBS volume in the EBS console.
  3. The type of the file system on the EBS volume is ext2, ext3, ext4, or xfs, and the file system contains no errors.

Operating environment

Operating environment Resource
Description
Operating system CentOS 6.5 64-bit
Data disk /dev/vdb: has no partitions and uses an ext4 file system. The capacity of the disk has been expanded from 200 GB to 2,200GB.
/dev/vdc: has no partitions and uses an xfs file system. The capacity of the disk has been expanded from 2,400 GB to 3,000 GB.

Procedure

  1. Run the following command to view the information about the file systems on the data disks attached to your KEC instance:

    df -Th
    The following figure shows the output. image.png The following table describes the information extracted from the figure. Data disk File system type Mount point
    /dev/vdb ext4 Mounted to /mnt/data_disk01
    /dev/vdc xfs Mounted to /mnt/data_disk02
  2. In the operating system of your KEC instance, resize a file system by running one of the following commands based on the type of the file system.

    • If the type of the file system is in the format of ext*, such as ext4, run the following command: Resize the file system on the /dev/vdb data disk
      resize2fs /dev/vdb

      The following figure shows the output. image.png

      Note: In the preceding command, /dev/vdb is the name of the data disk for which you want to allocate the expanded capacity. You must change it based on your business requirements.

    • If the type of the file system is xfs, run the following commands: Mount the data disk to a directory
      mount | grep /dev/vdc

      Resize the file system on the /dev/vdc data disk

      xfs_growfs /mnt/data_disk02

      The following figure shows the output. image.png

      Note: In the preceding commands, /mnt/data_disk02 is the mount point of the /dev/vdc data disk. You must change it based on your business requirements.

  3. Run the following command to check the resizing results:
    df -Th

    The following figure shows the output. image.png The figure shows that the resizing succeeded. When you check the results, compare the results with the original capacities.

    • If the resizing succeeded, the business programs on the KEC instance can continue to run as expected.
    • If the resizing failed, use the snapshot to roll back the data.
On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback