> For the complete documentation index, see [llms.txt](https://docs.cloudeka.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudeka.ai/guideline-for-enterprise/reference/extend-root-disk-guide.md).

# Extend Root Disk Guide

## Initial Condition

Claim disk space after upgrading from 40 GB → 80 GB on `/dev/vda1`. After the upgrade, the `/dev/vda` disk is recognized as 80 GiB (167,772,160 sectors), but the root partition `/dev/vda1` is still 39 GB with 91% utilization. The `vda1` partition is the last physical partition (ending at sector 83886046), so it can be extended directly into the available space behind it without moving any other partitions.

The `GPT PMBR size mismatch` and `backup GPT table is not on the end of the device` warnings are normal after resizing the disk because the backup GPT header is still located at the end of the old disk (40 GB). This will be fixed in [**Fix the GPT Backup Header**](#fix-the-gpt-backup-header)**.**

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2FJaNzr8IM8JU0MYcoQITq%2Fimage.png?alt=media&amp;token=b54a4562-1fea-489a-b8ff-71e6a0d13bd7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2882153758-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fi9YWb69HFXLHYlXffReU%2Fuploads%2FlyzZze30pwFS9ARCGDAx%2Fimage.png?alt=media&amp;token=e422f462-d61e-4131-931b-72e0db75a90d" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
**Note:** Before you begin, create a snapshot or backup of the VPS from the provider panel. All steps below must be performed as `root` and can be completed online without rebooting or unmounting the root filesystem.
{% endhint %}

## Check the Root Filesystem Type

Determine whether the root filesystem uses **ext4** or **xfs**, as the filesystem extension command differs for each type.

```bash
df -Th /
lsblk -f /dev/vda
```

## Install tool growpart dan gdisk

{% tabs %}
{% tab title="Ubuntu / Debian" %}

```bash
apt update && apt install -y cloud-guest-utils gdisk
```

{% endtab %}

{% tab title="RHEL / CentOS / Rocky / Alma" %}

```bash
dnf install -y cloud-utils-growpart gdisk
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
If the installation fails because the disk is full, first clean up the disk using `apt clean` and `journalctl --vacuum-size=100M` .
{% endhint %}

## Fix the GPT Backup Header

Move the backup GPT header to the end of the new disk (80 GB).

```bash
sgdisk -e /dev/vda
partprobe /dev/vda
```

## Extend partisi `/dev/vda1`

{% hint style="info" %}
Note that there is a space between `/dev/vda` and the partition number `1`.
{% endhint %}

```bash
growpart /dev/vda 1
```

{% hint style="info" %}
The expected output should look similar to: CHANGED: partition=1 start=2099200 old: size=81786847\
... new: size=...
{% endhint %}

## Extend filesystem

Choose the appropriate option based on the result from [**Check the Root From Filesystem Type**](#check-the-root-filesystem-type).

{% tabs %}
{% tab title="ext4" %}

```bash
resize2fs /dev/vda1
```

{% endtab %}

{% tab title="xfs" %}

```bash
xfs_growfs /
```

{% endtab %}
{% endtabs %}

## Verify The Results

```bash
lsblk /dev/vda
df -h /
fdisk -l /dev/vda
```

{% hint style="info" %}
The expected result is that `/dev/vda1` is approximately 79 GB in size, the root filesystem utilization decreases to around 45%, and the `GPT PMBR size mismatch` message no longer appears.
{% endhint %}

## Command Summary (ext4)

```bash
apt update && apt install -y cloud-guest-utils gdisk
sgdisk -e /dev/vda
partprobe /dev/vda
growpart /dev/vda 1
resize2fs /dev/vda1      # or: xfs_growfs /  (for xfs)
df -h /
```
