A: If your .vmdk is thin-provisioned, you're able to enlarge the .vmdk file, even while the VM is running (with vSphere 4, that is).
Say you didn't use LVM, but have a single partition that filled the whole disk (/dev/sda1):
First resize the partition in the partition table (using parted or fdisk) to fill the enlarged disk. You probably have to reboot your guest first in order to realize the size change of the disk.
Then, use resize2fs (xfs_growfs) to resize the file system to use the enlarged partition.
If you're using LVM, you might then just enlarge your physical volume:
- Resize the physical volume (pvresize)
- Enlarge the logical volume (lvresize)
- Finally, resize the file system (resize2fs or xfs_growfs).
B: If your .vmdk is thick-provisioned, though, it's not possible to enlarge the .vmdk file.
In this case, you'll have to add another disk (i.e. .vmdk file) to the VM in order to gain more disk space.
If you didn't use LVM, your only option is to partition the new disk and mount it somewhere.
If you're using LVM, you'll add the new disk to your volume group:
- Create a LVM partition on the new disk (fdisk)
- Set it up as another physical volume (pvcreate)
- Add this PV to the volume group (vgextend)
- Enlarge the logical volume (lvresize)
- Finally, resize the file system (resize2fs or xfs_growfs).