Categories
Uncategorized

Increasing storage on a RHEL 6 virtual machine with LVM

Recently I had to increase the available space on a virtual machine running RedHat Linux 6.   The filesystem was configured with LVM, so the quick answer that came to mind was to add another virtual hard drive and expand.  While this would work, it was “messy” as future expansion in this fashion would get out of hand.

Thankfully the solution was easier:

  1. Confirm your starting state to verify these steps work
    1. Check the free LVM space assuming “/dev/sdb” is your disk in that volume group, and “MyVG” is the name of the volume group.
      1. vgdisplay MyVG | grep Free
  2. Power down your virtual machine.
    1. In my experimenting, I could did this while the OS was running but it wasn’t 100% consistent.
  3. Expand the HDD size within the virtual system host environment
    1. In my case I am using VMware vSphere and increased from 60GB to 300GB.
  4. Boot the virtual machine
    1. It should boot without any difference than before.
    2. Login as root
  5. Run the “pvresize” command to tell the LVM subsystem to look at the new size of the HDD
    1. Assuming the drive in question is “/dev/sdb”, run this command:
      1. pvresize /dev/sdc
  6. You can confirm your LVM has additional space by noting the “Free” section of the output of the “vgdisplay” for the volume group that /dev/sdb is associated with
    1. vgdisplay MyVG | grep Free

 

 

Categories
Uncategorized

Happy New Year!

Happy New Year!