linux resize vmdk – device and physical volume

In this example a vmware vmdk is used by a CentOS 7 VM.
The original size of the vmdk is 1G, and is resized to 3G.

After this resizing in ESXi, run the following in the CentOS VM.
The name of the disk in CentOS is /dev/sdc.

Get the current situation:
fdisk -l |grep sdc
Disk /dev/sdc: 1073 MB, 1073741824 bytes, 2097152 sectors

Rescan the device:
echo 1 > /sys/block/sdc/device/rescan

Get the new situation:
fdisk -l |grep sdc
Disk /dev/sdc: 3221 MB, 3221225472 bytes, 6291456 sectors

View the physical volume:
pvdisplay /dev/sdc |grep -i pv\ size

Resize the physical volume:
pvresize /dev/sdc
1 physical volume(s) resized / 0 physical volume(s) not resized

View the physical volume:
pvdisplay /dev/sdc |grep -i pv\ size
PV Size 3.00 GiB / not usable 3.00 MiB

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.