root@esxihost# vmkfstools -X newSize [kK|mM|gG] /path/to/disk.vmdk
For Vmware Workstation use this command. For example:
# vmware-vdiskmanager -x 36GB myDisk.vmdk
The next steps are to rescan the bus for the new size to be recognized by the guest OS and resize the filesystem.
In my example I increased the size of sdb from 10G to 16G. The scsi address is 1.
Rescan the disk:
# echo 1 > /sys/class/scsi_disk/0\:0\:1\:0/device/rescan
# dmesg
[ 310.413691] sd 0:0:1:0: [sdb] Cache data unavailable
[ 310.413695] sd 0:0:1:0: [sdb] Assuming drive cache: write through
# fdisk -l /dev/sdb
Disk /dev/sdb: 16.1 GB, 16106127360 bytes, 31457280 sectors
SDB contains one partition that I need to increase to use the whole space on the disk. (a safer way is to create a new partition if using LVM and just resize the PV)
df shows my sdb disk has one partition which is 10G in size.
# df -h
/dev/sdb1 10G 36M 10G 1% /mnt
Steps to resize the partition:
1. Unmount the partition
2. delete partition 1 (using fdisk, option 'd')
3. save changes to disk (option 'w')
4. create a new partition on sdb with the new size (option 'n')
5. save changes to disk (option 'w')
Now I need to resize the filesystem. As this is a xfs filesystem I'm doing:
# xfs_growfs /export/sdb1/
meta-data=/dev/sdb1 isize=512 agcount=4, agsize=655296 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0
data = bsize=4096 blocks=2621184, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 2621184 to 3931904
# df -h
/dev/sdb1 15G 36M 15G 1% /mnt