Introduction

Today, most of Linux servers/clients use LVM as partition manager. But, in some case, sometimes you’ll need to struggle with standard partition schema.

In this post, I am going to show how to increase a partition size.

The server is a virtual machine, which second vmdk was increase in the hypervisor, but as you’ll see, we need to increase the partition size before expecting to use the full drive capacity.

Identifying disks and partitions

First of all, we need to identify the partition we need to expand. As you can see downside, we will work with /dev/sdb1 partition.

When looking disk size, we see that it has a capacity of 15GB, but only 10GB are provisioned on the partition :

1Extendpartition

Unmount partition

Second, we will unmount our partition :

2Extendpartition

Fdisk

Now that our partition is unmounted, we can safely recreate our partition.

Attention : we will delete then create the partition, but no worries! Only the partition is deleted then recreated, and the data will not be lost. However, it is always important to make a backup before doing something.

First, with p option we can show our drive and partition :

3Extendpartition

Then, we can delete (d) partition, create a new one (n), set it as primary (p) in our case, set partition number (1 there), and now the most important… set the first sector.

The first sector is something you need to identify from the p first command. Above, you can see Boot Start with 2048 value. You must use the value you got.

The last step is to use the write command (w) to commit our changes :

4Extendpartition

Before reboot

Now, everything is almost done. We need to touch this file before reboot :

5Extendpartition

After reboot

Once the OS reboot, you can launch resize2fs command so that you OS will update the value :

6Extendpartition

After all, you can do a new df -h command and you will see that your partition is updated with the new size.