Content is empty
If you don't find the content you expect, please try another search term
Last updated:2021-09-22 20:42:43
You have expanded the capacity of an EBS volume that uses MBR partitioning and has file systems. The capacity of the EBS volume after the expansion is less than 2 TB. You can resize the partitions and file systems on the EBS volume by using one of the following methods as needed:
Operating environment | Resource | Description |
---|---|---|
Operating system | CentOS 6.5 64-bit | |
Data disk | /dev/vdb: uses MBR partitioning and ext4 file systems. The capacity of the disk has been expanded from 50 GB to 200 GB. /dev/vdc: uses MBR partitioning and xfs file systems. The capacity of the disk has been expanded from 50 GB to 300 GB. |
lsblk
command to view the information about the partitions and mount points on the data disks attached to your KEC instance. In this example, the data disks are /dev/vdb
and /dev/vdc
.
lsblk
The following figure shows the output. The following table describes the information extracted from the figure. | Data disk | Partition | Partition description |
---|---|---|---|
/dev/vdb is the data disk with a capacity of 200 GB. | /dev/vdb1 | The capacity of the partition is 50 GB. The mount point is /mnt/data_disk01. | |
/dev/vdc is the data disk with a capacity of 300 GB. | /dev/vdc1 | The capacity of the partition is 50 GB. The mount point is /mnt/data_disk02. |
df -Th
The following figure shows the output. The following table describes the information extracted from the figure. | Partition | File system type | Mount point |
---|---|---|---|
/dev/vda1 | ext4 | Mounted to / | |
/dev/vdb1 | ext4 | Mounted to /mnt/data_disk01 | |
/dev/vdc1 | xfs | Mounted to /mnt/data_disk02 |
umount <Mount point>
command to unmount partitions. In this example, unmount the /dev/vdb1
partition from the /mnt/data_disk01
mount point.
umount /mnt/data_disk01
Note: Before you proceed to the next step, make sure that you have unmounted all the partitions of the data disks for which you want to allocate the expanded capacity.
growpart /dev/vdb 1
In this example, resize the partitions /dev/vdb1 and /dev/vdc1 of the data disks. Separate /dev/vdb and 1, or /dev/vdc and 1, with a space in the command. If you need to resize other partitions, modify the command as needed. The following figure shows the output.
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.
e2fsck -f /dev/vdb1
Resize the file system of the /dev/vdb1 partition on the /dev/vdb data disk
resize2fs /dev/vdb1
The following figure shows the output.
Note: In the preceding commands,
/dev/vdb1
is the partition name. You must change it based on your business requirements.
mount /dev/vdc1 /mnt/data_disk02
Resize the file system of the /dev/vdc1 partition on the /dev/vdc data disk
xfs_growfs /mnt/data_disk02
The following figures show the output.
Note: In the preceding commands,
/mnt/data_disk02
is the mount point of the/dev/vdc1
partition. You must change it based on your business requirements.
mount <Partition name> <Mount point>
command to manually mount the resized partitions. In this example, mount the /dev/vdb1
partition to the mnt/data_disk01
mount point.
mount /dev/vdb1 /mnt/data_disk01
df -Th
The following figure shows the output. The figure shows that the resizing succeeded. When you check the results, compare the results with the original capacities.
Operating environment | Resource | Description |
---|---|---|
Operating system | CentOS 6.5 64-bit | |
Data disk | /dev/vdb: uses MBR partitioning and ext4 file systems. Keep the capacity of Partition 1, which is 50 GB, unchanged and create Partition 2 with a capacity of 150 GB. /dev/vdc: uses MBR partitioning and xfs file systems. Keep the capacity of Partition 1, which is 50 GB, unchanged and create Partition 2 with a capacity of 250 GB. |
lsblk
command to view the information about the partitions and mount points on the data disks attached to your KEC instance. In this example, the data disks are /dev/vdb
and /dev/vdc
.
lsblk
The following figure shows the output. The following table describes the information extracted from the figure. | Data disk | Partition | Partition description |
---|---|---|---|
/dev/vdb, data disk is the with a capacity of 200 GB. | /dev/vdb1 | The capacity of the partition is 50 GB. The mount point is /mnt/data_disk01. | |
/dev/vdc, data disk is the with a capacity of 300 GB. | /dev/vdc1 | The capacity of the partition is 50 GB. The mount point is /mnt/data_disk02. |
df -Th
The following figure shows the output. The following table describes the information extracted from the figure. | Partition | File system type | Mount point |
---|---|---|---|
/dev/vda1 | ext4 | Mounted to / | |
/dev/vdb1 | ext4 | Mounted to /mnt/data_disk01 | |
/dev/vdc1 | xfs | Mounted to /mnt/data_disk02 |
umount <Mount point>
command to unmount partitions. In this example, unmount the /dev/vdb1
partition from the /mnt/data_disk01
mount point.
umount /mnt/data_disk01
Note: Before you proceed to the next step, make sure that you have unmounted all the partitions of the data disks for which you want to allocate the expanded capacity.
Run the fdisk <Data disk name>
command to create a partition. In this example, create a partition with a capacity of 150 GB on the /dev/vdb
data disk.
fdisk /dev/vdb
Perform the following steps as prompted: a. Enter p: View the information about the existing partitions. In this example, the existing partition is /dev/vdb1. b. Enter n: Create a partition. c. Enter p: Create a primary partition. d. Enter 2: Create another primary partition. e. Press the Enter key twice: Use the default size for the partition to be created. f. Enter w to Save the partition table and start partitioning. The following figure shows the output.
Note: In this example, only one partition is created. You can create multiple partitions as needed.
Run the following command to view the new partition:
lsblk
The following figure shows the output. In this example, a partition is also created for the /dev/vdc
data disk by following Step 4.
Run the mkfs.<fstype> <Partition name>
command to format the new partitions and create file systems.
To create an ext* file system, for example, ext4, run the following command:
Create an ext4 file system for the /dev/vdb2 partition on the /dev/vdb2 data disk
mkfs.ext4 /dev/vdb2
The following figure shows the output.
Note: In the preceding command,
/dev/vdb2
is the partition name. You must change it based on your business requirements.
mkfs.xfs -f /dev/vdc2
The following figure shows the output.
Note: In the preceding command,
/dev/vdc2
is the partition name. You must change it based on your business requirements. If the message-bash: mkfs.xfs: command not found
appears, run theyum -y install xfsprogs
command to install the RPM package of xfsprogs.
mkdir <New mount point>
command to create a mount point for each new partition. In this example, create the /mnt/data_disk03
mount point.
mkdir /mnt/data_disk03
mount <Partition name> <Mount point>
command to manually mount the new partitions. In this example, mount the /dev/vdb2
partition to the /mnt/data_disk03
mount point.
mount /dev/vdb2 /mnt/data_disk03
df -Th
The following figure shows the output. The figure shows that the resizing succeeded. When you check the results, compare the results with the original capacities.
Description of optional actions If you want the new partitions of the data disks to be automatically mounted to the KEC instance when the KEC instance starts or restarts, perform the following steps to add the information about the new partitions to the /etc/fstab file.
/dev/vdb2
partition to the /mnt/data_disk03
mount point.
echo '/dev/vdb2 /mnt/data_disk03 ext4 defaults 0 0' >> /etc/fstab
cat /etc/fstab
command to view the auto-mount configuration.
cat /etc/fstab
The following figure shows the output.
Pure Mode