Saturday, January 22

How to resize or extend the root partition in centos?

All the Linux file systems are stored in the root partition. Sometimes we feel the provided storage is enough for the system but eventually, we need more storage at the root. So, In this post, I will share the steps to resize or extend the root partition. This method is also applied to RHEL.

When we extend the storage in the system. We need to find out that how much free storage we have left.

# parted
(parted) print free

show free space

There is a 10.7GB free space/storage. we will add this free storage to the root partition. Press q to exit.

Next step, we need to run fdisk tool or command to manage disk or volumes. Run fdisk /dev/sda to access the disk management. press p to print or show the details of the disk.

fdisk print the details

In the picture above, we can see the current details of the disk. Please note the start block, id, and system type of the /dev/sda2 which is a root partition. The start block is 2099200, id is 8e and the system is Linux LVM.

Press d to delete the partition and select the partition which we want to delete. 2 is the partition number we will delete in this demo.

Delete partition

press or select n to create a new partition. select the partition primary or extended. we have selected the p (primary) in this demo. And select partition number 2 which we have deleted.
Select the first sector, we are continuing with the default value because the default value and pretended value in the upper step are the same. So, just press the enter.
The tricky part is to select the Last Sector. We can see the total blocks of the last sector in default value. it means if we continue with the default value it will assign all the free space or storage to the created partition. But if we want to save some free storage for other options we can define the specific size by defining the K, M, G where K=Kilobyte, M=Megabype, and G= GigaByte. For example: if our requirement is to increase 5GB only in the root, we can define 5GB so that the rest of the free storage we can use for other options.

Create new partition

In this demo, I have selected the default value. The root partition will grow or increase by 10.7GB.

We can see that the new partition id and the system are different from the original.

Check new partition type

Press or select the t to change the id and system. 2 is the partition number. Hex code is 8e.

Change the partition type

The partition id and system are converted to the original state. press p to print the details.
Now we need to write the changes we have been made. press w. Partition changes have been saved but there is an error which says that the system is busy. so, reboot the system.

Write the changes

after rebooting the system. we need to run a few resize commands and the final message is data block changed.

#pvresize /dev/sda2
#lvresize /dev/mapper/centos-root /dev/sda2
#xfx_growfs /dev/mapper/centos-root

pvresize, lvresize and sfx_growfs

In the final step, we will check and verify that the root partition has been increased using parted command again parted and print free.

Verify the partition increse

The root partition is changed or increased from 42.9GB to 53.7GB.


  • Hey, my name’s Eric and for just a second, imagine this…

    – Someone does a search and winds up at

    – They hang out for a minute to check it out. “I’m interested… but… maybe…”

    – And then they hit the back button and check out the other search results instead.

    – Bottom line – you got an eyeball, but nothing else to show for it.

    – There they go.

    This isn’t really your fault – it happens a LOT – studies show 7 out of 10 visitors to any site disappear without leaving a trace.

    But you CAN fix that.

    Talk With Web Visitor is a software widget that’s works on your site, ready to capture any visitor’s Name, Email address and Phone Number. It lets you know right then and there – enabling you to call that lead while they’re literally looking over your site.

    CLICK HERE to try out a Live Demo with Talk With Web Visitor now to see exactly how it works.

    Time is money when it comes to connecting with leads – the difference between contacting someone within 5 minutes versus 30 minutes later can be huge – like 100 times better!

    Plus, now that you have their phone number, with our new SMS Text With Lead feature you can automatically start a text (SMS) conversation… so even if you don’t close a deal then, you can follow up with text messages for new offers, content links, even just “how you doing?” notes to build a relationship.

    Strong stuff.

    CLICK HERE to discover what Talk With Web Visitor can do for your business.

    You could be converting up to 100X more leads today!

    PS: Talk With Web Visitor offers a FREE 14 days trial – and it even includes International Long Distance Calling.
    You have customers waiting to talk with you right now… don’t keep them waiting.
    CLICK HERE to try Talk With Web Visitor now.

    If you’d like to unsubscribe click here

Leave a Reply

Your email address will not be published. Required fields are marked *