How to Extend LVM Inside a VM

Posted by : on

Category : esx   linux   vmware


These instructions have been applied to RedHat and CentOS. I have seen some instances, where these instructions broke the VM. (So I make no promises. They worked for me.)

Article: How to Extend LVM Inside a VM

  1. Gracefully shutdown virtual machine.
  2. SSH into ESX Server as ‘root’ and navigate to the datastore containing the vmdk that you need to extend.
  3. vmkfstools -X G virtual.vmdk (Enter the total size of the new HD - 10G)
  4. Start virtual machine and open a terminal window.
  5. fdisk /dev/sda (if only 1 disk on linux)
  6. in fdisk, create new partition with new freespace (n,new partition#,start,stop)
  7. in fdisk, change new partition type to 8e (linux lvm)(t,new partition#,8e)
  8. in fdisk print out partition table to verify (p)
  9. in fdisk write partition and exit (w)
  10. partprobe (shouldn’t be necessary, but rereads partitions)
  11. pvcreate /dev/sda3 (if new partition is 3rd partition)
  12. vgextend VolumeGroupName /dev/sda3 (add new partition to VG)
  13. lvextend -L+1G /dev/VolGroup00/LogVol00 (assuming LogVol00 is lv you wish to grow)
  14. ext2online /dev/VolGroup00/LogVol00 (extend an ext3 partition to fill the LV) (if you want a specific size: ext2online -L10G /dev/VolGroup00/LogVol00) (if you want to grow a specific size: ext2online -L+1G /dev/VolGroup00/LogVol00) (Some OSes (CentOS) uses resize2fs: ex. resize2fs /dev/VolGroup00/LogVol00.)
  15. sync

About Sam Aaron
Sam Aaron

Father, Husband, Geek. Workaholic.

Email : mail@micronauts.us

Website : http://micronauts.us

About Sam Aaron

Father. Husband. Geek. Workaholic. US Marine Corps Veteran.

Sam Aaron is a Senior Consultant in the Professional Services Organization for Entelligence, bringing over a decade of expertise in enterprise cloud automation and infrastructure. Sam has spent almost eleven years at VMware leading cloud automation initiatives using VCF Automation (formerly Aria Automation & vRA) and designing scalable, multi-tenant environments with VMware Cloud Director (vCD).

Sam holds multiple certifications including VCF-Architect 2024, VCIX-CMA, and dual VCPs (DCV & CMA), and is a recognized contributor to VMware’s certification exams. As a VMware Hands-On Lab (HOL) Captain and content author from 2015-2025, Sam played a key role in educating and mentoring the global VMware community. He helped to create and develop the automation challenge and troubleshooting labs for VMworld and global virtual forums.

When Sam is not working, he has several hobbies, among these are 3D printing Star Wars robots and turning them into animatronics.

Launched in April 2010, micronauts is Sam's online presence. Here, he has been blogging and sharing knowledge with the virtualization community. This blog acts as a central repository to retain the resolutions and other trivial knowledge that Sam has discovered.

** No information provided here was reviewed or endorsed by VMware by Broadcom, Microsoft, or anyone else for that matter. All information here are opinions based on Sam's personal experience. Use this knowledge at your own risk. **

Star
Useful Links