Multi-Partition Data Disk_Linux
This operation instance assumes that the data disk capacity is less than 2TiB. If the data disk capacity is larger than 2TiB, please refer to the section "2TiB Disk Partition Enlargement". If the host has previously divided multiple partitions, then you can use the following method for expansion.
Notice:
We recommend that you do not partition the cloud hard disk on the cloud host to avoid affecting the enlargement of the cloud hard disk. Please confirm before the disk enlargement operation, if there is data in the data disk, it is recommended that you backup the data first. The cloud hard disk can only be enlarged when it is in the available state. As the cloud hard disk needs to be uninstalled, it will interrupt your business, so please operate carefully. Since the newly enlarged space is attached to the end of the virtual disk, for the multi-partition scenario, only the partition that is placed at the end can be expanded.
Operational Notes:
- This example uses the fdisk command as a case, and the parted command cannot be used interchangeably with the fdisk command.
- In this example, the cloud hard disk mount point is /dev/vdb, please operate according to the actual situation. If you do not see the corresponding device, please check the cloud hard disk mount information and status.
Specific operations:
- View the current mounting situation, file system type, and partition situation
Note: The lsblk command result shows that there are two partitions vdb1 and vdb2 under vdb, which are multiple partitions, and expansion can be performed according to the scheme described in this document. For other situations, please refer to the relevant document for expansion.
- Unmount the cloud hard disk in the operating system and console, for specific steps, see the section of Unmounting Cloud Hard Disk. Enlarge the cloud hard disk through the cloud disk console.
- Mount the cloud hard disk in the console, for specific steps, see the section on Mounting Cloud Hard Disk. After mounting is completed, check the size of the disk in the operating system.
- Use the fdisk command to delete the second partition (/dev/vdb2) and create a new partition.
`Note: Deleting the partition will not cause the loss of data on the data disk.`
- Check the file system and expand it.
Note: Under different file systems, the commands to check and expand are different. Please confirm your file system type and operate according to the corresponding operation steps.
ext file system
- Execute e2fsck -f /dev/vdb2 and resize2fs /dev/vdb2 to check and expand operations respectively.
- Use the mount command to remount the disk.
xfs file system
- Execute xfs_repair /dev/vdb2 to check the file system.
- Use the mount command to remount the disk.
- Execute xfs_growfs command to expand.