> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Extend a Partition with growpart and resize2fs

> Extend a partition after a disk upgrade: run growpart /dev/vda 1, then resize2fs /dev/vda1 for ext4 or xfs_growfs / for XFS. No reboot or unmount needed.

After a disk upgrade, Linux sees the bigger disk but your partition and file system keep their old size. Extend the partition with `sudo growpart /dev/vda 1`, then grow the file system: `sudo resize2fs /dev/vda1` for ext4, or `sudo xfs_growfs /` for XFS. Both can grow while the server is running. Check the result with `df -h /`.

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Intermediate | 10 minutes | Ubuntu, Debian, AlmaLinux, Rocky Linux, Fedora | sudo, a backup, a disk that is already bigger |

## Before you start

* **Take a backup first.** Changing a partition table on a live disk is safe when done right, but a mistake can make the server unbootable. On a VPS, take a [panel backup](https://help.freakhosting.com/portals/vps-panel/how-to-schedule-and-restore-backups.md) right before you start; also see [back up a Linux server](https://help.freakhosting.com/portals/other/how-to-back-up-a-linux-server.md).
* [Connect with SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). Commands use `sudo`; root users can leave it out.
* Have a way in if SSH stops working: on a VPS, the [VNC console](https://help.freakhosting.com/portals/vps-panel/how-to-enable-and-use-vnc-console-access.md) and [rescue mode](https://help.freakhosting.com/portals/vps-panel/how-to-use-rescue-mode.md); on a dedicated server, your KVM/IPMI console or a [ticket](https://freakhosting.com/clientarea/submitticket.php).
* If your root file system is on **LVM** (the `TYPE` column shows `lvm`), follow these steps up to the partition, then continue in [use LVM on Linux](https://help.freakhosting.com/portals/other/how-to-use-lvm-on-linux.md).

> [!WARNING]
>
> Never delete and recreate a partition by hand unless you know the exact start sector. `growpart` only moves the end of the partition and keeps your data in place. Only **grow**: shrinking a partition below the size of its file system destroys data.

## How to check that the disk is bigger

```bash theme={null}
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINTS /dev/vda
```

```text theme={null}
NAME    SIZE TYPE FSTYPE MOUNTPOINTS
vda     160G disk
├─vda1   79G part ext4   /
├─vda14   4M part
└─vda15 106M part vfat   /boot/efi
```

The disk (`vda`) is 160G, but the root partition (`vda1`) is still 79G. If the disk still shows the old size, reboot the server and check again.

Your disk may be named differently: `/dev/sda` on SATA/SAS, `/dev/nvme0n1` on NVMe (partition `/dev/nvme0n1p1`). On a VPS, the [Storage page](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md) shows the disk size.

## How to install growpart

> [tab] Ubuntu / Debian
>
> ```bash theme={null}
> sudo apt update && sudo apt install cloud-guest-utils
> ```

> [tab] AlmaLinux / Rocky / Fedora
>
> ```bash theme={null}
> sudo dnf install cloud-utils-growpart
> ```

## How to grow the partition and file system

**1. Preview the change**

```bash theme={null}
sudo growpart --dry-run /dev/vda 1
```

Note the space between the disk (`/dev/vda`) and the partition number (`1`). For NVMe use `sudo growpart /dev/nvme0n1 1`.

**2. Grow the partition**

```bash theme={null}
sudo growpart /dev/vda 1
```

```text theme={null}
CHANGED: partition=1 start=227328 old: size=165431263 end=165658590 new: size=335316959 end=335544286
```

`NOCHANGE: partition 1 is size … it cannot be grown` means there is no free space directly after the partition.

**3. Check the file system type**

```bash theme={null}
df -T /
```

**4. Grow the file system**

> [tab] ext4
>
> ```bash theme={null}
> sudo resize2fs /dev/vda1
> ```
>
> ```text theme={null}
> Filesystem at /dev/vda1 is mounted on /; on-line resizing required
> The filesystem on /dev/vda1 is now 41914619 (4k) blocks long.
> ```

> [tab] XFS
>
> `xfs_growfs` takes the **mount point**, not the device:
>
> ```bash theme={null}
> sudo xfs_growfs /
> ```
>
> ```text theme={null}
> data blocks changed from 20678907 to 41914619
> ```

## How to check it worked

```bash theme={null}
df -h /
```

```text theme={null}
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       157G   31G  120G  21% /
```

The `Size` column now shows the larger size. No reboot is needed.

## What if the root partition is not the last one?

`growpart` can only extend a partition into free space directly after it. If another partition, such as a swap partition, sits after root, `growpart` reports `NOCHANGE`. Options:

* Leave root as it is and use the new space as a separate partition: create it with `parted` and mount it as in [mount a new disk](https://help.freakhosting.com/portals/other/how-to-mount-a-new-disk-on-linux.md).
* Remove the swap partition (turn it off with `swapoff` and remove it from `/etc/fstab` first), grow root, then use a [swap file](https://help.freakhosting.com/portals/other/how-to-add-swap-space-on-linux.md) instead. Only do this with a fresh backup and console access.

## Frequently asked questions

### Do I need to reboot or unmount to resize?

No. ext4 and XFS both grow while mounted, including `/`. A reboot is only needed if the kernel does not see the new disk size yet.

### Can I shrink an XFS file system?

No. XFS cannot be shrunk. ext4 can be shrunk, but only while unmounted, for example from rescue mode, and it is risky without a backup.

### Why does resize2fs say "Nothing to do!"?

The partition has not been grown yet, or `growpart` failed. Run `lsblk` and check the partition size first.

### I upgraded my plan but the disk is the same size. What now?

Reboot once and check `lsblk` again. If the disk is still the old size, check the [Storage page](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md) or [open a ticket](https://freakhosting.com/clientarea/submitticket.php).

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Use LVM on Linux](https://help.freakhosting.com/portals/other/how-to-use-lvm-on-linux.md)
>
> Extend a logical volume after growing the disk.

> [card] [Mount a new disk](https://help.freakhosting.com/portals/other/how-to-mount-a-new-disk-on-linux.md)
>
> Format and mount extra disks.

> [card] [Check disk space](https://help.freakhosting.com/portals/other/how-to-check-disk-space-on-linux.md)
>
> Confirm the new free space.

> [card] [VPS storage](https://help.freakhosting.com/portals/vps-panel/how-to-view-and-manage-vps-storage.md)
>
> See your disk size in the panel.

***

> [!NOTE]
>
> **Checked against the official [Red Hat Enterprise Linux 9 guide to increasing an XFS file system](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/managing_file_systems/increasing-the-size-of-an-xfs-file-system_managing-file-systems) and the `growpart` and `resize2fs` manual pages** on 4 November 2026; `growpart`, online `xfs_growfs` and offline `resize2fs` tested on Ubuntu 24.04 LTS using loop devices. Commands can differ on other distributions or releases.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.