by JoKeru

Increase VM disk capacity

Ever needed a bigger disk (not for root) inside your Guest OS (powered by VMware)? Look no further, I have the answer.

You don't need to stop the guest, this operation is done on a running VM.

Login on you vCenter, edit the VM's settings, increase disk size to the needed value. That's it on the virtualization layer.

Now let's update the guest also:

# stop all services that need access to that disk / mount

# re-read the new disk geometry
$ cd /sys/class/scsi_disk
$ echo 1 > 2\:0\:1\:0/device/rescan

# increase the partition size - don't worry, no data will be lost, only the partition table will be recreated
$ umount /dev/sdb1
$ parted /dev/sdb print fix fix
$ parted /dev/sdb --script -- rm 1
$ parted /dev/sdb --script -- mkpart primary 1 -1

# increase the filesystem size
$ e2fsck -f /dev/sdb1
$ resize2fs /dev/sdb1
$ mount /dev/sdb1