Centos – add space to virtual disk on vmware

centoshotswaplvmvirtualizationvmware-server

I have a VMWare Server 3.5 system with 2 VMs. On one powered on vm I changed the disk size from 1TB to 1,5TB. But the vm didn't see any new unallocated space so that I reboot twice the server.
But nothing was happened… the OS on guest is CENTOS and the two disks are LVM.
fdisk see the new space… but none partitions on the disk.. lvm does not see any free space…

[root@srv-archive ~]# dmesg |grep sdb
sd 2:0:1:0: [sdb] 3145728000 512-byte logical blocks: (1.61 TB/1.46 TiB)
sd 2:0:1:0: [sdb] Write Protect is off
sd 2:0:1:0: [sdb] Mode Sense: 61 00 00 00
sd 2:0:1:0: [sdb] Cache data unavailable
sd 2:0:1:0: [sdb] Assuming drive cache: write through
sd 2:0:1:0: [sdb] Cache data unavailable
sd 2:0:1:0: [sdb] Assuming drive cache: write through
 sdb: sda1 sda2
sd 2:0:1:0: [sdb] Cache data unavailable
sd 2:0:1:0: [sdb] Assuming drive cache: write through
sd 2:0:1:0: [sdb] Attached SCSI disk
dracut: Scanning devices sda2 sdb  for LVM logical volumes vg_srvarchive/lv_swap vg_srvarchive/lv_root

and fdisk

 # fdisk -l /dev/sdb

Disco /dev/sdb: 1610.6 GB, 1610612736000 byte

255 testine, 63 settori/tracce, 195812 cilindri
Unità = cilindri di 16065 * 512 = 8225280 byte
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Identificativo disco: 0x00000000

and the following is the pvdisplay where u can see 0 free space:

# pvdisplay 
--- Physical volume ---
PV Name               /dev/sdb
VG Name               vg_archive
PV Size               1000,00 GiB / not usable 4,00 MiB
Allocatable           yes (but full)
PE Size               4,00 MiB
Total PE              255999
Free PE               0
Allocated PE          255999
PV UUID               3Qftxe-rpff-TjTA-9CA4-BoeM-qEgc-RzSzXL

I want only expand my lvm device..
thanks very much
cheers luigi

Best Answer

You might want to try a different approach:

 - Power down the VM     
 - Create a new disk for the VM using the VMWARE control panel with the additional size you want
 - do a pvcreate on the new disk
 - do a vgextend adding the new disk
 - then you can do whatever lvextend you need.
 - REMEMBER the filesystems will need to be extended as well.
Related Topic