Expanding Virtual Machine Memory and Disk Space in CentOS 7 on VMware

Expanding Virtual Machine Resources in CentOS 7

This guide provides a comprehensive walkthrough for expanding memory and disk space in a CentOS 7 virtual machine running on VMware Workstation. The process involves both VMware configuration changes and Linux system administration tasks to properly utilize the additional resources.

Virtual Machine Environment

  • Host OS: Windows 10 Education, 64-bit (Build 22000.1817)
  • Hypervisor: VMware Workstation 16 Pro (Version 16.2.3)
  • Guest OS: CentOS Linux 7 (Core)

Expanding VM Memory

  1. Shut down the virtual machine completely.
  2. Open VM settings by right-clicking the VM and selecting "Settings".
  3. Navigate to the "Memory" tab.
  4. Adjust the memory slider to your desired allocation.
  5. Click "Save" to apply the changes.
  6. Power on the virtual machine. The memory expansion is now complete.

Expanding Virtual Disk

  1. Ensure the VM is powered off.
  2. Open VM settings and select the "Hard Disk" from the hardware list.
  3. Click the "Expand" button in the Disk Utilities section.
  4. Enter the new maximum disk size and click "Expand".
  5. After completion, you'll see a message: "The disk has been successfully expanded. You must partition and expand the file system from within the guest operating system."
  6. Power on the VM to proceed with OS-level configuration.

Partitioning the New Disk Space

After booting into CentOS, verify the disk expansion:

df -h

You should notice that the total disk capacity (/dev/sda) now reflects the expanded size, but the filesystem hasn't yet been updated to use the addditional space.

Start the partitioning process:

fdisk /dev/sda
  1. Type 'n' to create a new partition.
  2. Accept the default values for partition type (primary), partition number (3), and sectors.
  3. Type 'p' to print the partition table and verify the new partition exists.
  4. Type 'w' to write the changes and exit fdisk.

Reboot the system to ensure the partition table is updated:

reboot

Integrating the New Partition with LVM

After rebooting, verify the partition is recognized:

fdisk -l

Format the new partition with the ext3 filesystem:

mkfs -t ext3 /dev/sda3

Initialize the partition as a physical volume for LVM:

lvs
pvcreate /dev/sda3

Display available physical volumes to verify the initialization:

pvdisplay

Extend the volume group (replace 'centos_super' with your actual volume group name):

vgextend centos_super /dev/sda3

Check the free space in the volume group:

vgdisplay

Look for "Free PE / Size" which should show the available space (e.g., 2559 / <10.00 GiB).

Extend the logical volume (replace with your actual volume path):

lvextend -L+9.9G /dev/mapper/centos_super-root /dev/sda3

Resize the filesystem to utilize the new space. For ext filesystems:

resize2fs /dev/mapper/centos_super-root

If you encounter an error "Bad magic number in super-block", check the filesystem type with:

mount |grep root

For XFS filesystems, use the appropriate command:

xfs_growfs /dev/mapper/centos_super-root

Finally, verify that the expansion was successful:

df -h

The output should now show the increased filesystem size (e.g., 45G instead of the previous 35G).

Tags: VMware centos LVM virtualization Disk Management

Posted on Thu, 10 Sep 2026 16:21:39 +0000 by johnsmith153