Find the answer to your Linux question:
Results 1 to 9 of 9
I have RedHat 5 VMWare image whose Hard Disk MAX capacity is set to 12 GB. The Physical Volume size is set to 11 GB and the Logical Volume /dev/VolGroup00/LogVol00 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Posts
    1

    Cannot increase size of Logical Volume on RedHat Linux VMWare Image


    I have RedHat 5 VMWare image whose Hard Disk MAX capacity is set to 12 GB.

    The Physical Volume size is set to 11 GB and the Logical Volume /dev/VolGroup00/LogVol00 currently uses 6.88 GB (Physical and Logical Volume details below). But I am unable to extend the Logical Volume by another 3 GB.

    I have tried the following list of commands but have not been successful in increasing /extending the size of the Logical Volume


    [root@localhost ~]# lvresize -L +3GB /dev/VolGroup00/LogVol00
    Finding volume group VolGroup00
    Archiving volume group "VolGroup00" metadata (seqno 5).
    Extending logical volume LogVol00 to 9.88 GB
    Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 6).
    Found volume group "VolGroup00"
    Found volume group "VolGroup00"
    Loading VolGroup00-LogVol00 table
    device-mapper: reload ioctl failed: Invalid argument
    Failed to suspend LogVol00
    [root@localhost ~]#

    So, I tried making the logical volume unavailable before trying to resize it but am unable to do so.

    [root@localhost ~]# lvchange -an -v /dev/VolGroup00/LogVol00
    Using logical volume(s) on command line
    Deactivating logical volume "LogVol00"
    Found volume group "VolGroup00"
    LV VolGroup00/LogVol00 in use: not deactivating



    Also tried using lvextend command to resize the Logical Volume but that does not help either.
    root@localhost ~]# lvextend -L +3G -v /dev/VolGroup00/LogVol00
    Finding volume group VolGroup00
    Archiving volume group "VolGroup00" metadata (seqno 5).
    Extending logical volume LogVol00 to 9.88 GB
    Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 6).
    Found volume group "VolGroup00"
    Found volume group "VolGroup00"
    Loading VolGroup00-LogVol00 table
    device-mapper: reload ioctl failed: Invalid argument
    Failed to suspend LogVol00


    Any help will be greatly appreciated.

    Premal


    For your Info:
    ==============

    [root@localhost ~]# pvdisplay
    --- Physical volume ---
    PV Name /dev/sda2
    VG Name VolGroup00
    PV Size 11.00 GB / not usable 31.81 MB
    Allocatable yes
    PE Size (KByte) 32768
    Total PE 351
    Free PE 99
    Allocated PE 252
    PV UUID 5luGYQ-bx6o-okqL-yMbK-pqxo-eZ3N-E9n0Jh

    [root@localhost ~]# lvdisplay
    --- Logical volume ---
    LV Name /dev/VolGroup00/LogVol00
    VG Name VolGroup00
    LV UUID DEkoOp-Zs82-nVba-YVye-xIX1-1qms-YxOwsk
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 6.88 GB
    Current LE 220
    Segments 1
    Allocation inherit
    Read ahead sectors 0
    Block device 253:0

    --- Logical volume ---
    LV Name /dev/VolGroup00/LogVol01
    VG Name VolGroup00
    LV UUID 4vi3r7-vaVW-grwz-QFJr-2DvM-BV02-vNmYVr
    LV Write Access read/write
    LV Status available
    # open 1
    LV Size 1.00 GB
    Current LE 32
    Segments 1
    Allocation inherit
    Read ahead sectors 0
    Block device 253:1

    [root@localhost ~]#

  2. #2
    Just Joined!
    Join Date
    May 2007
    Posts
    5

    similar problem

    I'm having a similar problem with Redhat 5 under VMware ESX 3.5:

    step 1: shut down VM, edit VM settings, increase HDD from 10G to 20G
    step 2: boot into VM, fdisk -l /dev/sda now shows the disk is 21.4GB
    step 3: pvresize --setphysicalvolumesize 20G /dev/sda2
    step 4: vgdisplay now shows 323 free PE
    step 5: lvresize -v -l +323 /dev/VolGroup00/LogVol00 gives the following errors:

    Finding volume group VolGroup00
    Archiving volume group "VolGroup00" metadata (seqno 5).
    Extending logical volume LogVol00 to 18.03 GB
    Creating volume group backup "/etc/lvm/backup/VolGroup00" (seqno 6).
    Found volume group "VolGroup00"
    Found volume group "VolGroup00"
    Loading VolGroup00-LogVol00 table
    device-mapper: table: device 8:2 too small for target
    device-mapper: table: 253:0: linear: dm-linear: Device lookup failed
    device-mapper: ioctl: error adding target to table
    device-mapper: reload ioctl failed: Invalid argument
    Failed to suspend LogVol00

    Didn't make any difference when I increased the PV from 10G to 15G instead of 20G, used lvextend instead of lvresize, used fewer extents than the available extents, or tried expanding the size of LogVol01 instead of LogVol00 (LogVol01 is swap). Also tried these commands while booted into rescue mode (not mounting system partition) from the redhat 5.2 DVD but this did not change the results either.

    Just for grins I built a non-esx redhat 5.2 test box, and while I wasn't able to test pvresize (LVM used the entire disk of /dev/sda with no option otherwise), I was able to successfully increase the size of a logical volume as long as free extents were available.

  3. #3
    Just Joined!
    Join Date
    Aug 2008
    Posts
    3

    VMtools

    I also tried to resize the disk with a FC9 VMware image and I could not get it to work. However, I did not have the VMtools installed on my image when I was trying this. Maybe that will make a difference. Give it a shot.

  4. #4
    Just Joined!
    Join Date
    May 2007
    Posts
    5

    tools

    I did have the vmware tools installed and configured for the current kernel, but thanks for the suggestion.

  5. #5
    Just Joined!
    Join Date
    May 2007
    Posts
    5
    Aha! A redhat tech pointed out a missing step. After resizing the disk in vmware, and before running pvresize, I had to run fdisk, delete the lvm partition, and re-create it using the new size. After that, pvresize and lvextend worked perfectly.

  6. #6
    Just Joined!
    Join Date
    Mar 2009
    Posts
    1
    hi! jimbeasley ,
    I'm quite new to linux and may not able to keep up to ur pace. Do you think you can show your expertise to elaborate the steps you mentioned below?

    "After resizing the disk in vmware, and before running pvresize, I had to run fdisk, delete the lvm partition, and re-create it using the new size. After that, pvresize and lvextend worked perfectly."

  7. #7
    Just Joined!
    Join Date
    May 2007
    Posts
    5

    notes for increasing HDD in a redhat linux virtual machine using LVM

    dratengon, here are my notes, I hope they are helpful to you:

    Edit VM settings. Increase HDD size.
    If root volume is on LVM, boot to redhat ISO & select rescue mode, select 'skip' when mounting system partition. Otherwise proceed.
    fdisk, remove partition #2, create new partition, change type to 8e, write and exit
    lvm pvresize /dev/sda2 ?- this resets the size of the physical volume to capacity
    lvm pvdisplay ?- make a note of the free PE (physical extents)
    lvm vgchange -a y ?- activate logical volumes so we can resize them
    lvm lvdisplay ?-- shows the logical volumes
    e2fsck -f /dev/VolGroup00/LogVol00
    lvm lvextend -l +extents volumegroupname
    resize2fs /dev/VolGroup00/LogVol00


    To create a 10GB logical volume named LogVol02 inside the volume group /dev/VolGroup00:

    lvm lvcreate -L 10G -n LogVol02 /dev/VolGroup00
    mkfs.ext3 /dev/VolGroup00/LogVol02 ?- don't forget to format the volume before mounting it up in /etc/fstab

    We can also label filesystems (not a bad idea in case we lose fstab information)
    e2label /dev/VolGroup00/LogVol02 home-dirs

    note: ext2online performs the same function as resize2fs except that it works for mounted filesystems. But, I'm not sure whether it is possible to resize the root filesystem while it is mounted (I doubt it)

  8. #8
    Just Joined!
    Join Date
    Feb 2009
    Posts
    1
    However, I did not have the VMtools installed on my image when I was trying this. Maybe that will make a difference.

  9. #9
    Just Joined!
    Join Date
    Nov 2010
    Posts
    1
    Thank you for your notes jimbeasley. They were really helpful. I messed up on the fdisk step - so I added some more details. Again, I highly recommend backing up your data before doing this. I destroyed my virtual hard disk the first time I tried and had to revert from the backup to try again.

    1. Edit VM settings. Increase HDD size.
      • If root volume is on LVM, boot to redhat ISO & select rescue mode, select 'skip' when mounting system partition. Otherwise proceed.
    2. fdisk, remove partition #2, create new partition, change type to 8e, write and exit
      • fdisk -l /dev/sda // Should show two boot devices, and the start and stop cylinder for each. Also note the system id (mine was 8e).
      • fdisk /dev/sda // Starts fdisk on /dev/sda
      • d // delete
      • 2 // partition 2
      • n // new partition
      • p // create primary type
      • 2 // partition 2
      • <enter> // Use default start and stop cylinder
      • <enter>
      • t // Change the system id
      • 2 // partition 2
      • 8e // Type is Linux LVM
      • w // Write and exit
    3. lvm pvresize /dev/sda2 ?- this resets the size of the physical volume to capacity
    4. lvm pvdisplay ?- make a note of the free PE (physical extents)
    5. lvm vgchange -a y ?- activate logical volumes so we can resize them
    6. lvm lvdisplay ?-- shows the logical volumes
    7. e2fsck -f /dev/VolGroup00/LogVol00
    8. lvm lvextend -l +extents volumegroupname
      • extents should be the Free PE from the lvm pfdisplay above
      • volumegroupname is /dev/VolGroup00/LogVol00
      • So full command I used was:
      • lvm lvextend -l +160 /dev/VolGroup00/LogVol00
    9. resize2fs /dev/VolGroup00/LogVol00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •