Search Our Database

How to extend partition for Linux Server

Last updated on |

Introduction

As your system data grows over time, system administrators and server users need to expand disk space to prevent server downtime and service disruptions on IPServerOne Linux servers. This guide explains how to safely extend an existing partition and resize the filesystem directly within your operating system environment. By using standard Linux terminal utilities on your Debian-based or RHEL-based machine, you can allocate unassigned disk space and expand your storage capacity on-demand without losing existing files.

 

Prerequisite

  • Access to the Linux server via SSH terminal or VNC console
  • Root privileges or a user account with full sudo access
  • Basic knowledge of Linux command-line operations

 

Step-by-step guide

Step 1: Access the instance vis SSH

 

Step 2: Extending the partition

Debian-based Linux (Ubuntu / Debian)

Extending partitions on Debian-based systems typically utilizes growpart to expand the partition table followed by resize2fs to resize the ext4 file system online.

Click to expand
  • Verify the current disk and partition layout.
    lsblk
  • Install Cloud Guest Utilities if growpart is not already installed.
    sudo apt update && sudo apt install -y cloud-guest-utils
  • Extend the target partition (for example, partition 1 on block device /dev/vda).
    sudo growpart /dev/vda 1
  • Resize the ext4 file system to utilize the full allocated space.
    sudo resize2fs /dev/vda1

 

RHEL-based Linux (AlmaLinux / Rocky Linux)

RHEL-based distributions commonly utilize the XFS file system. The partition expansion is handled using growpart and increased using xfs_growfs.

Click to expand
  • Check the existing disk space and partition structure.
    lsblk
  • Install cloud-utils-growpart if the utility is not present.
    sudo dnf install -y cloud-utils-growpart
  • Expand the target partition (for example, partition 1 on block device /dev/vda).
    sudo growpart /dev/vda 1
  • Grow the XFS file system using the mount point location (e.g., root mount /).
    sudo xfs_growfs /

 

Step 3: Verified the changes

  • Confirm that the extra space is recognized by the file system.
    df -h

 

Conclusion

By following this guidance, you can successfully extend the partition for your Linux server across Debian-based or RHEL-based distributions without disrupting existing server files.

 

For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.