How to resize an ext4 and XFS root partition on Linux Cloud Servers

2021-03-01 By Mark 8903 Views linux resize disk storage
9 reviews

You can upgrade your server disk/plan if you need more storage and efficiency for your Cloud Servers via LayerPanel. This guide will help you to extend or resize an ext4 or XFS file system once you upgrade and can be a root partition configured with ext4 or XFS filesystem, but without LVM configuration.


  1. Run the below command to check the current root disk capacity

    # lsblk
    

    linuxresize1


    You can see in the above output that the / is mounted on /dev/vda3 and its size is 247G. But the total disk is 300G in this server.

  2. The first step you need to do to expand the disk space is to install the necessary tools. Run the below command to install cloud utils.


    On Ubuntu / Debian system, run the below command:

    # apt -y install cloud-guest-utils gdisk
    

    On CentOS system, run the below command:

    # yum -y install cloud-utils-growpart gdisk
    

    linuxresize2

  3. Now run the below command to extend your partition and it will resize partition 3 on /dev/vda.

    # growpart /dev/vda 3
    

    linuxresize3

  4. Again, run the below command to Validate the changes and you can see here that /dev/vda3 is extended to 297G.

    # lsblk
    

    linuxresize4

  5. Now run the below command to resize / partition to fill all space.


    For ext4 file system, run the below command:

    # resize2fs /dev/vda3
    

    For XFS file system, run the below command:

    # xfs_growfs /
    

    linuxresize5

  6. You can verify the new size using the below command.

    # df -hT | grep /dev/vda
    

    linuxresize6


Related Tutorial

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.