resizing LVM on VMware Linux host

Posted on 2011-10-11
Last Modified: 2012-08-13

I'd like to ask you if someone could provide an answer for my question.

We have VMware RedHat Linux host, which has one virtual disk LVM configured:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             6.8G  4.9G  1.6G  76% /
tmpfs                1014M     0 1014M   0% /dev/XXX
/dev/sdb1             197G  181G  6.0G  97% /YYY
/dev/sdc1              20G   19G  503M  98% /log
                       98G   64G   30G  69% /ZZZ

I've resized the last disk from 100gb to 350gb in VMware vCenter on host, started the host, but I can't see the free space or something else which should indicate that the disk was expanded.

  PV /dev/sdd1   VG vg0   lvm2 [99.98 GB / 1008.00 MB free]
  Total: 1 [99.98 GB] / in use: 1 [99.98 GB] / in no VG: 0 [0   ]

do you have any ideas how should I rescan it or what is necessary to perform to see&resize the disk.

thanks so much in advance.
Question by:ZUNO
    LVL 117

    Assisted Solution

    by:Andrew Hancock (VMware vExpert / EE MVE)
    What you need to remember is that you have expanded the disk which is presented to the OS.

    Disk Expansion does not expand the partitions inside the OS, you need to expand the partition manually.

    Before making any changes to the partition structure of the disk, ensure you have a full backup, not a snapshot.

    1. Resize partition with Gparted Live CDROM

    i. Download Gparted Live CDROM (

    ii. Upload the cdrom iso to the vSphere ESX/ESXi datastore.

    iii. Mount the cdrom or iso on the virtual machine.

    iv. Shutdown and restart the virtual machine booting from the cdrom.

    v. Select Resize partition.

    Here is a Tutorial Walkthorugh of how to resize a partition with a GParted Live CDROM

    LVL 117

    Expert Comment

    by:Andrew Hancock (VMware vExpert / EE MVE)
    or here, this article may help you

    LVM Resizing Guide
    LVL 23

    Assisted Solution

    hi Zuno,

    as mentioned you can use fdisk to first format the free space as a new partition and use the command

    vgextend "existing vol group" new partition created after extending the disk.

    however you cannot extend a existing LVM parition with newly added free space if there is a swap partitition between

    LVM can be extended only between contigious disk space

    i ran into issue when my redhat box had the / volume mounted on logvol01 and swap on logvol00 as by default the swap parition is created on the end of disk

    LVL 2

    Accepted Solution

    I think everyone has posted good info. See if this helps:

    To extend the logical volume:

    Note: These steps only apply to EXT3 file systems.
    Caution: VMware recommends having a complete backup of the virtual machine prior making these changes.
    1.Power off the virtual machine.
    2.Edit the virtual machine settings and extend the virtual disk size. For more information, see Increasing the size of a virtual disk (1004047).
    3.Power on the virtual machine.
    4.Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:

    fdisk -l

    5.Create a new primary partition:

    a.Run the command:

    fdisk /dev/sda (depending the results of the step 4)
    b.Press p to print the partition table to identify the number of partitions. By default there are 2: sda1 and sda2.
    c.Press n to create a new primary partition.  
    d.Press p for primary.
    e.Press 3 for the partition number, depending the output of the partition table print.
    f.Press Enter two times.
    g.Press w to write the changes to the partition table.

    7.Restart the virtual machine.
    8.Run this command to verify that the changes were saved to the partition table and that the new partition has an 83 type:

    fdisk -l

    9.Run this command to convert the new partition to a physical volume:

    pvcreate /dev/sda3

    10.Run this command to extend the physical volume:

    vgextend VolGroup00 /dev/sda3

    11.Run this command to verify how many physical extents are available to the Volume Group:

    vgdisplay VolGroup00 | grep "Free"

    12.Run the following command to extend the Logical Volume:

    lvextend -L+#G /dev/VolGroup00/LogVol00

    Where # is the number of Free space in GB available as per the previous command.

    13.Run the following command to expand the ext3 filesystem online, inside of the Logical Volume:

    ext2online /dev/VolGroup00/LogVol00

    Note: Use resize2fs instead of ext2online if it is not a Red Hat virtual machine.

    14.Run the following command to verify that the / filesystem has the new space available:

    df -h /


    Author Comment

    thanks guys, you all have posted very useful info, but ..

    I was thinking if there's a possible solution to do it without restart of VM and more simple - so finally, I assigned new virtual disk to that VM, assigned him to volume group, using pvmove I moved the old partition to new one and finally I've resized logical volume and filesystem ...

    this solution was less complex and without hurting me a lot :) , just have one restart & old disk was removed as it was moved to new one, so no longer it was needed ...

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    VMware vCenter Converter Standalone 5.0 is a FREE tool available from VMware upon registration, the purpose of this software tool is to easily convert physical or virtual computers, images of computers to VMware virtual machines. Server and Workstat…
    In vSphere 4 1 and 5.0, you can enable both Remote SSH and the ESXi Shell for management of hosts from the vSphere Client and from the Direct Console User Interface. You may have noticed that on enabling both Remote SSH and the ESXi Shell for man…
    Teach the user how to install ESXi 5.5 and configure the management network System Requirements: ESXi Installation:  Management Network Configuration: Management Network Testing:
    Teach the user how to use configure the vCenter Server storage filters Open vSphere Web Client:  Navigate to vCenter Server Advanced Settings: Add the four vCenter Server storage filters: Review the advanced settings: Modify the values of the four v…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now