How to extend the disk size in my VMware guest running Centos 7

To increase the disk size inside the VMware guest running CentOS7 (7.3, 1611) these are the steps needed:

a. Remove all snapshots from your Vmware image, or if you cannot afford to remove the snapshot, shutdown the guest OS, and "clone from snapshot" (you can select any specific snapshot to clone) to create a new Vmware image. This new one is totally independent, and will not have any of the snapshot.

b. Now go to VMware settings, hardware, and "hard disk" to select "Expand Disk" option.

c. After expanding disk, reboot into your CentOS.

d. Issue "sudo fdisk /dev/sda" to repartition the /dev/sda inside the guest OS:

And here is the partition deletion and recreation part (be careful) – the starting block number must be the same, but the end will default to the largest possible block number.

Now remember to REBOOT, as the partition table will not be updated until after reboot.

And now check using pvdisplay – it is not updated yet, still 75G. Use "pvresize" to extend it.

So now the PV occupies 200G.

Now check with lvdisplay:

So we need to extend the LV to 200G:

Followed by xfs_growfs:

Check now:

Updated.

10 responses to this post.

  1. Posted by Andy Ritting on November 27, 2018 at 9:09 am

    thanks, this is exactly what I needed.

    Reply

  2. Posted by Lycée Français de Kuala Lumpur on December 13, 2018 at 4:10 pm

    Perfect, a big thanks ! Worked liked a charm.

    Reply

  3. Posted by Bones Cisco on December 31, 2018 at 1:48 am

    Awesome worked perfectly
    I wanted to show appreciation

    Reply

  4. Thanks Peter – this was step for step perfect

    Reply

  5. Nice mate , straight to the point ! Thank you!

    Reply

  6. perfect… work very good 😀 thank you boss !!

    Reply

  7. Posted by moredakka79 on September 5, 2019 at 1:50 pm

    Worked perfectly! Thanks!

    Reply

  8. Posted by icepig vivien on February 11, 2020 at 3:36 pm

    save my life! thanks!

    Reply

  9. Posted by Nathan Marsili on September 1, 2020 at 9:53 am

    This saved me also, thank you! Does anyone know if these instructions above would work for increasing home instead of root, by just replacing with centos-home?

    Reply

Leave a comment

Vickblöm

Research scattered with thoughts, ideas, and dreams

Penetration Testing Lab

Offensive Techniques & Methodologies

Astr0baby's not so random thoughts _____ rand() % 100;

@astr0baby on Twitter for fresh randomness

The Data Explorer

playing around with open data to learn some cool stuff about data analysis and the world

Conorsblog

Data | ML | NLP | Python | R

quyv

Just a thought

IFT6266 - H2017 Deep Learning

A Graduate Course Offered at Université de Montréal

Deep Learning IFT6266-H2017 UdeM

Philippe Paradis - My solutions to the image inpainting problem

IFT6266 – H2017 DEEP LEARNING

Pulkit's thoughts on the course project

Thomas Dinsmore's Blog

No man but a blockhead ever wrote except for money -- Samuel Johnson

the morning paper

a random walk through Computer Science research, by Adrian Colyer

The Spectator

Shakir's Machine Learning Blog