1

I'm running Oracle Enterprise Linux 5.6 as a virtual machine inside Virtualbox 4.0.12 on my mac. Initially I had allocated 8G of hard disk space and now I increased the virtual hard disk size to 30G.

After the reboot, although fdisk tells me there is 31.4G, the root logical volume is still showing the old disk space. This is the output of fdisk.

[root@xyz ~]# fdisk -l

Disk /dev/sda: 31.4 GB, 31457280000 bytes
255 heads, 63 sectors/track, 3824 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1044     8281507+  8e  Linux LVM

Disk /dev/dm-0: 6341 MB, 6341787648 bytes
255 heads, 63 sectors/track, 771 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

Disk /dev/dm-1: 2113 MB, 2113929216 bytes
255 heads, 63 sectors/track, 257 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-1 doesn't contain a valid partition table

This is the output of df -h

[root@xyz ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      5.8G  5.4G   40M 100% /
/dev/sda1              99M   61M   34M  65% /boot
tmpfs                 2.9G     0  2.9G   0% /dev/shm
[root@xyz ~]# 

Output of vgdisplay:

[root@xyz ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup00
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               7.88 GB
  PE Size               32.00 MB
  Total PE              252
  Alloc PE / Size       252 / 7.88 GB
  Free  PE / Size       0 / 0   
  VG UUID               k5viVC-eWvO-9wuG-146f-cGjk-RAHK-yDRJKz

output of pvscan:

[root@xyz ~]# pvscan
  PV /dev/sda2   VG VolGroup00   lvm2 [7.88 GB / 0    free]
  Total: 1 [7.88 GB] / in use: 1 [7.88 GB] / in no VG: 0 [0   ]
[root@xyz ~]# 

I need help with resizing the LVM logical volume to 30G, Thanks!

1
  • Can we have the output of vgdisplay?
    – Bittrance
    Aug 30, 2011 at 22:08

2 Answers 2

0

Do the following:

 1. use fdisk create a new primary partition using the available open space.  
    For this example it would be /dev/sda3.  
 2. pvcreate /dev/sda3 to set it up
 3. vgextend /dev/VolGroup00 /dev/sda3
 4. do a vgdisplay and see how many open extents you have on VolGroup00.  
    For this example assume 407 extents are open
 5. lvextend -l +407 /dev/VolGroup00/LogVol00
 6. resize2fs /dev/VolGroup00/LogVol00 (assumming ext2/ext3)

This procedure should work without having to unmount the root disk if you are using a Linux 2.6 kernel.

1
  • hey mdpc, thanks! even this link helped a bit
    – frank.C
    Aug 31, 2011 at 13:10
0

You can look at /usr/sbin/pvscan to see how much space is left in the physical volumes and which volume group they are attached to.

In your case /usr/sbin/lvextend --size +25G /dev/VolGroup00/LogVol00 && /sbin/resize2fs /dev/VolGroup00/LogVol00 should fix you right up.

3
  • I added the output of pvscan, thanks! Is that +25G an approximation?
    – frank.C
    Aug 30, 2011 at 22:19
  • This will fail without doing some partition modifications as I have described in my procedure.
    – mdpc
    Aug 30, 2011 at 22:20
  • Yeah, I didn't see that his partition wasn't the full size of the disk, which didn't do him any favors as it complicates the resize procedure as you have described above
    – mtinberg
    Aug 30, 2011 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .