Extend root logical volume for VM with Oracle Linux of VMWare

Evgeniy Yablokov asked:

Please make me sure did I wrong thing, or not.

I’m resizing the root partition which is under the LVM. This server is a VMWare’s virtual machine with Oracle Linux. I’m using this article: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006371

I think I made a mistake. After 2nd part I booted the VM in a rescue mode, checked that size was the same. Then I recreated 3rd partition (root under LVM) and gave its type as 8e for LVM. I received a partition with the same start point and extended last point. I wrote changes of frisk.

Then I executed pvcreate /dev/sda3 command. It didn’t allowed me to do this without -ff key.

So, I made a mistake and can’t turn back. I didn’t rebooted yet, I passed the system in rescue mode for a time.

Please give an advising is it possible to cancel this situation and make corrections?

Thank you.

My answer:

You had everything right, up until pvcreate. It’s not necessary to do this if you resized the existing disk partition instead of creating a new one. If you actually ran it with the force flag, then it destroyed all your data. If you did not, then you are safe.

The next step, of course, is to restart the system and lvextend -r your desired logical volume. (-r here automatically resizes the filesystem in the logical volume, so you don’t have to do that separately as the outdated KB article indicates.)

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.