X
X

Select Your Currency

Türk Lirası $ US Dollar
X
X

Select Your Currency

Türk Lirası $ US Dollar

Knowledge Base

Ubuntu Disk Expansion

 

Ubuntu Server Disk Space Expansion Guide

 

On Ubuntu-based VPS and VDS servers, running out of disk space can cause service interruptions, performance degradation, and application failures. In many cases, users increase disk capacity from the provider panel but notice that the operating system does not automatically use the newly added space. This occurs because disk expansion at the system level must be completed manually.

 

This article explains how to expand disk space on an Ubuntu server in a clear and structured way, suitable even for users with limited technical experience.

 

Checking Current Disk Usage

 

Before starting the expansion process, the current disk usage should be reviewed.

df -h

This command displays all mounted file systems and their usage ratios. If the root partition is close to full capacity, disk expansion is required.

 

Verifying That the New Disk Space Is Detected

 

After increasing disk size from the server provider panel, the system must recognize the new space.

lsblk

This command lists all disks and partitions attached to the server. Disk names may differ depending on the environment. Some systems use sda1 or sda3, while others use names such as nvme0n1p3. This variation is normal and depends on the server configuration.

The main goal is to identify which disk or partition is mounted as the root directory.

 

Checking Whether LVM Is in Use

 

Most modern Ubuntu server installations use Logical Volume Manager (LVM). If the output of lsblk shows entries marked as lvm, the system is using LVM. If LVM is not present, the disk expansion process will differ.

 

Expanding the Physical Volume

 

Once the correct disk or partition is identified, the physical volume must be resized to include the newly added space.

pvdisplay

This command lists all physical volumes. After identifying the physical volume associated with the root file system, resize it using the following command.

pvresize /dev/sdX

The sdX value depends on the server configuration. It may be sda3, sda2, or an NVMe-based identifier. Selecting the wrong disk can lead to data loss, so verification is critical.

 

Verifying Volume Group Free Space

 

After resizing the physical volume, check whether the free space is available in the volume group.

vgdisplay

If free space is displayed, the logical volume can now be expanded.

 

Expanding the Logical Volume

 

Next, identify the logical volume used by the root directory.

lvdisplay

In most Ubuntu installations, the root logical volume appears similar to the following path.

/dev/ubuntu-vg/ubuntu-lv

To allocate all available free space to the root logical volume, run the following command.

lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv

At this stage, only the logical volume size is increased. The file system itself must still be expanded.

 

Resizing the File System

 

Most Ubuntu servers use the ext4 file system. To make the additional space usable, resize the file system.

resize2fs /dev/ubuntu-vg/ubuntu-lv

After this operation, the newly added disk space becomes active.

 

Verifying the Expansion

 

Finally, confirm that the disk space has been expanded successfully.

df -h

If the root file system shows the increased capacity, the operation has been completed successfully.

 

Common Mistakes

 

Resizing the wrong disk or partition
Using LVM commands on systems without LVM
Attempting expansion before increasing disk size from the provider panel
Performing disk operations without backups

These mistakes can result in data loss or system instability.

 

Expanding disk space on an Ubuntu server is a straightforward process when performed correctly. However, improper disk selection or incorrect commands can cause serious issues. In enterprise environments, disk management operations should be carefully planned and executed by experienced professionals to ensure system stability and continuity.

Did you find it useful?
(33 times viewed / 0 people found it helpful)

Can't find the information you are looking for?

Create a Support Ticket
Top