Post

How to extend a partition in linux?

Let’s say that we have a disk of 100GB called /dev/sda and we have a partition of 50GB called /dev/sda1.

We would need growpart, What is growpart?

A utility to extend the last partition of the disk with remaining free space. Growpart modifies the sector position to the end sector of the disk. This doesn’t create or delete any existing partition.

How to install growpart in rhel?

1
yum install cloud-utils-growpart -y

Now, to use the unallocated space we can run following commands:

1
growpart /dev/sda 1

The above would extend the partition but we would still need to extend the filesystem to use the space. Following are the examples based on filesytem types.

xfs:

1
xfs_growfs /dev/sda1

ext4/ext3/ext2:

1
resize2fs /dev/sda1

Thanks!

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.