Skip to main content

Guide to Expanding Partition Space on a Cloud Server

Before adding a disk to the operating system, you must create it in your server management panel.

Steps to Expand a Disk in the Management Panel

Expanding the Operating System Disk

  1. Log in to the Control Panel:
    • Sign in to your account and go to the Cloud Server section.
  2. In the Server tab, access your server management panel.
  3. In your server management page, click on Resource Plan. extend1
  4. Then, increase the size of your operating system disk. extend1
caution

Please note that you cannot reduce the allocated disk size.

Steps to Expand Partition Space

1. Identifying New Space in the Operating System

After increasing the disk size, the operating system must recognize the new space:

sudo fdisk -l

This command lists the existing disks and partitions. The new space should appear as unallocated.

2. Extending the Existing Partition

To expand the existing partition, execute the following commands:

sudo fdisk /dev/vdX

Follow these steps after executing fdisk:

  1. Enter p to list the current partitions.
  2. Note the partition number you want to extend.
  3. Enter d and select the partition number to delete it.
  4. Enter n to create a new partition.
  5. Specify the partition type (usually primary) and select the same partition number as before.
  6. Enter the Start sector exactly as the previous value.
  7. For the End sector, select the suggested value (maximum size) to utilize all the new space.
  8. Save changes and exit with w.

In this example, /dev/vdX or vtbdX is the disk, and 1 is the partition number.

3. Expanding the Filesystem

After expanding the partition, extend the filesystem:

sudo resize2fs /dev/vdX1

Note: For the XFS filesystem, xfs_growfs must be executed on the mount point.

4. Verifying Configuration

To ensure proper configuration, check the settings:

df -h

Important Notes:

  • Always back up your data before making any partition changes.
  • Carefully execute commands according to your disk and partition structure.
  • For more details, refer to your Linux distribution's official documentation.