Expanding VMWare hdd not being seen by Centos OS LVM

Issues related to applications and software problems
Post Reply
kiweegie
Posts: 1
Joined: 2015/08/26 10:27:19

Expanding VMWare hdd not being seen by Centos OS LVM

Post by kiweegie » 2015/08/26 12:11:23

Although I'm doing this in VMWare I'm pretty sure the issues I'm facing are OS related not VMWare.

I have managed to resize a number of virtual Centos machines with the process outlined below. I have a couple of machines which are failing to increase or see the increased space provided by VMWare.

Steps (example refers to increasing /dev/sda2)

Code: Select all

fdisk -l
to list existing partitions

Code: Select all

fdisk /dev/sda
delete /dev/sda2 then recreate it (d, 2, n, p, 2)
set type to LVM (t, 2, 8e)
set start and end partitions to defaults shown (enter, enter)
Go to expert mode to set new beginning sector (x, b, 2, enter) to accept defaults, I've not ever needed to change this
Write changes (w)

Reboot OS at this stage so OS can see the resized partition

Code: Select all

pvresize /dev/sda2
- force detection of new space

Code: Select all

vgdisplay
- look for free Physical Extents (PE)

Code: Select all

lvextend -l +(number of free PEs) /dev/Volgroupname_lv_root
- expand the logical volume

Code: Select all

resize2fs /dev/mapper/Volgroup-lv_root
- expand partition into newly resized LVM

This has as stated above worked fine in most cases. I have a couple of machines where its failed at the recreating /dev/sda2 part as it recreates a partition of the same size as the deleted one. Something is preventing the OS from seeing the new VM disk size. Oddly I've cloned VMs to work on without impacting live systems and the cloned drive works as expected :(

Is the above process the accepted best practice for what I am trying to achieve? I've seen some posts suggesting adding a new partition rather than delete and recreate an existing one. Is that the preferred method here? Increasing the existing partition seems cleaner to me somehow - what happens if you need to expand again, there's only a finite number of primary partitions one can add.

I'm also wondering if something in the process of cloning the VM disk is "fixing" the underlying issue in the OS. I've been banging my head against this one for a couple weeks now so any input would be most welcome

regards, Kiweegie

Post Reply