Sunday, January 17, 2016

FreeBSD Virtual Machine: Resizing and Growing Disks - VMware ESXi

Just for training purpose, I've decided to increase the virtual machine disk size from the default 21Gb to 32Gb, just by following the handbook guide. It would give the VM more run for FreeBSD ports and give a change to play around with disk resizing.

1. The gpart command shows the actual disk size (this virtual machine has a single hard disk of aroung 21Gb):

2. Increase the provisioned size in the virtual machine properties from 21 to 32Gb:

3. Reboot; by running the gpart command again, it says that the disk is corrupted:

4. Run the gpart recover command, and the free space will be updated accordingly:

5. Run gpart resize command: -i INDEX -a ALIGNMENT -s SIZE which can be in gigabytes (G) or megabytes (M):

6. The last part of the handbook says "Grow the UFS file system to use the new capacity of the resized partition" by using the command growfs. However it did not work: Operation not permitted, even running as the root user:

7. Later on I found in the forum that the growfs can be executed as a service. Now the resize operation is completed: