Extending Linux Partition or Filesystem without LVM

There may be a scenario come to us to extending linux partition or filesystem that is not configured with LVM. This post will help you with How to extend linux partition or filesystem without LVM.

If you are interested in learning, Request you to go through the below recommended tutorial.

DevOps Full Course Tutorial for Beginners - DevOps Free Training Online
Docker Full Course Tutorial for Beginners - Docker Free Training Online
Kubernetes Full Course Tutorial for Beginners - Kubernetes Free Training Online
Ansible Full Course Tutorial for Beginners - Ansible Free Training Online
Openstack Full Course Tutorial for Beginners - Openstack Free Training Online
Learn Linux, DevOps and Cloud

I’m going to take the example of a Linux guest under VMware Workstation though this should apply to most hypervisors and flavors of Linux.

Prequisites before extending linux partitions

If your guest VM is critical, we strongly recommended to take a backup to prevent the accidental damages.

We don’t have LVM, Our only option is to increase the size of the hard disk and then expand the partition containing the filesystem we wish to expand.

Consider the example that we have a disk of 5GB for a testing purpose it has some data. We will extend that partition to another 5GB. SO totally we will have a 10GB Partition finaly.

Extending Linux Partition or Filesystem without LVM

This procedure is 100% working method for How to extend Linux Partition or Filesystem:

1. Ensure the disk number, size, cylinders and sectors of the disks to extend using the fdisk command as below.


extending linux partition


In our example, our disk is /dev/sdb which has 5GB size, 10485760 Sectors and mounted in the directory /data

2. Extend the required size 10GB in Hypervisors such as vmware esx, vmware workstation and Microsoft Hyper-V before carrying out the activity.

3. Reboot the server and check again the disks detected using the fdisk command. Now we will see newly extended size as below screenshot.


extend linux partition without lvm


4. Now extend the existing /dev/sdb1 partition to the end cylinder available as shown in the screenshot below.


How to Extend Linux Partition on Linux 


Short description as shows in the above screenshot in steps,

a. fdisk /dev/sdb

b. p (to view partition details)

c. d (to delete the partition)

d. 1 (to select the second partition)

e. n (to create new partition) and select the partition type whether Primary or Extended Partition

f. 1 (to create it as partition 1)

g. Get the first block from the partition details earlier i.e. 2048. Enter this block as start value.

h. Press enter to accept the default as the last block.

i. p (to to list the partition and confirm)


Finally re-read the partition table (partprobe) and resize the extended partition  using the below command,
[root@server1 ~]# partprobe
[root@server1 ~]# resize2fs /dev/sdb1

Thats it.

Post a Comment

0 Comments