How to Resize the Disk Partition, using CLI, After Upgrading my Tariff Plan on my VPS

Hostry offers our customers a VPS tariff plan upgrade. This procedure is performed by requesting technical support. After your plan has been successfully changed, this will be displayed on your orders page. In addition, an important procedure should be followed – disk enlargement. We recommend using gparted for this. This article aims to help you perform this disk expansion procedure quickly, efficiently, and without losing your data. It is worth informing that after successful completion of this procedure, the server will be rebooted for a few seconds. Be sure to take this factor into account and choose a convenient time for yourself to perform this procedure, so the Linux kernel takes care, that the virtual drive has been expanded.

Grown the partition and File System

For the following file systems: xfs, ext4, btrfs, ntfs (for Windows, starting from Vista) is possible to growth online (i.e. without unmounting before proceeding). Ntfs and btrfs even can shrink online, other file systems only then aren’t mounted).

First of all, you need the root access to your VPS server. After login, you need to run the lsblk command. Here you can see all disk devices, their volume, and partitions. In this screenshot, you can see that vda has a size of 50 GB, and in this case, vda1 + vda2 have 30 GB. After that, please enter the parted /dev/vda

As we can see, the command parted is run. Next, we run the command – p (Print), which shows the partitions and offers to change/fix the GPT table so that it matches the size of the virtual disk.
We agree – we write: Fix

After that, we need to run resizepart 2 – this is the command that marks the resize of the partition. You can take the final number from the size of the disk – the size can be seen on screen 2 – 53, 7GB

Finally, you need to use the q command – it exits parted. For the ext3 / ext4 filesystem format, the following command: resize2fs /dev/vda2

Done! At this stage, the changes are complete.

For xfs, you can use the command: xfs_growfs

For btrfs, you can use the command: btrfs filesystem resize

For ext4, you can use the command: resize2fs /dev/vda2

Was this article helpful?

Related Articles

Leave A Comment?