Add a new virtual volume to an LVM partition of a virtual VMWare system running a RedHat type Operating System

lvm

 

 

  • Add a new drive to your virtual machine using the graphical VMware tool, currently VMware vSphere
  • Reboot the virtual machine so the new drive can be seen by the host Operating System
  • Launch the command vgdisplay as root in order to get the name of your LVM virtual group:

> vgdisplay
— Volume group —
VG Name               myvg
System ID
Format                lvm2
Metadata Areas        5
Metadata Sequence No  10
VG Access             read/write
VG Status             resizable
…etc

  • Use the command pvdisplay (i.e. “physical volume display”) as root in order to get the device name (/dev/sdx) of your new drive. You are looking for an entry that shows “Allocatable  no”
  • Add the new device to the volume group:
    vgextend myvg /dev/sdx
  • Get the location (LV Path) of your logical volume using lvdisplay (i.e. “logical volume display”)> lvdisplay
    — Logical volume —
      LV Path                /dev/myvg/rootvol
    …etc
  • Resize the logical volume, adding the size of the new drive (in this example 30 gigabytes):
    lvresize -L +30G /dev/myvg/rootvol
  • Resize the partition of the logical volume. Resize2fs is able to detect the system is live and is able to apply the correct change, even on the root partition:
    resize2fs /dev/myvg/rootvol
  • Optionally reboot the virtual machine, just to make sure all is fine
Advertisements

About nidget

Technology enthousiast, Java and JEE expert, IT architect.
This entry was posted in Tips and tricks and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s